From 0aa9c35d0c7e0b72a58608f7f0f45630b641b907 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 4 Sep 2018 04:06:50 -0700 Subject: [PATCH] announce improvements --- Zotlabs/Lib/Activity.php | 6 ++++-- Zotlabs/Lib/ActivityStreams.php | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index af3fa3340..d5598891c 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1456,13 +1456,14 @@ class Activity { $s['edited'] = $s['created']; if(in_array($act->type,['Announce'])) { + $s['mid'] = $act->id; + $s['parent_mid'] = $act->id; $announced_actor = ((isset($act->obj['actor'])) ? $act->obj['actor'] : $act->get_actor('attributedTo', $act->obj)); if(! $announced_actor) { return []; } self::actor_store($announced_actor['id'],$announced_actor); $s['author_xchan'] = $announced_actor['id']; - } $s['title'] = self::bb_content($content,'name'); @@ -1644,12 +1645,13 @@ class Activity { $item['parent_mid'] = $p[0]['parent_mid']; } - $r = q("select created, edited from item where mid = '%s' and uid = %d limit 1", + $r = q("select id, created, edited from item where mid = '%s' and uid = %d limit 1", dbesc($item['mid']), intval($item['uid']) ); if($r) { if($item['edited'] > $r[0]['edited']) { + $item['id'] = $r[0]['id']; $x = item_store_update($item); } else { diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index e7a5ad1f7..2d3facf8c 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -254,7 +254,7 @@ class ActivityStreams { logger('blacklisted: ' . $url); return null; } - + logger('fetch: ' . $url, LOGGER_DEBUG); $x = z_fetch_url($url, true, $redirects, [ 'headers' => [ 'Accept: application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ]]); if($x['success']) { @@ -262,6 +262,9 @@ class ActivityStreams { logger('returned: ' . json_encode($y,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); return json_decode($x['body'], true); } + else { + logger('fetch failed: ' . $url); + } return null; }