From 9e24b8c55feec3f88fe5ee450ebce4f66735a599 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 12 Jun 2019 21:01:44 -0400 Subject: [PATCH 1/2] Fix formatting and PHPDoc in ActivityPub\Processor Add expected return value to postMail method --- src/Protocol/ActivityPub/Processor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 9eb1506a28..1ac29d9e9f 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -442,8 +442,8 @@ class Processor * * @param array $activity Activity data * @param array $item item array + * @return int|bool New mail table row id or false on error * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @throws \ImagickException */ private static function postMail($activity, $item) { @@ -497,7 +497,7 @@ class Processor } $msg['body'] = $item['body']; - Mail::insert($msg); + return Mail::insert($msg); } /** From 94a70f54d13e958668e08e884547af1e8862c020 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 12 Jun 2019 21:02:37 -0400 Subject: [PATCH 2/2] Normalize the datetime format of received activity before DB insertion in ActivityPub\Processor - Restore private message storage --- src/Protocol/ActivityPub/Processor.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 1ac29d9e9f..61f6389cad 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -142,7 +142,7 @@ class Processor } $item['changed'] = DateTimeFormat::utcNow(); - $item['edited'] = $activity['updated']; + $item['edited'] = DateTimeFormat::utc($activity['updated']); $item = self::processContent($activity, $item); if (empty($item)) { @@ -382,8 +382,8 @@ class Processor $item['uri'] = $activity['id']; - $item['created'] = $activity['published']; - $item['edited'] = $activity['updated']; + $item['created'] = DateTimeFormat::utc($activity['published']); + $item['edited'] = DateTimeFormat::utc($activity['updated']); $item['guid'] = $activity['diaspora:guid']; $item = self::processContent($activity, $item);