From ae4ba193b86e4316cbedc3c562af2f78c5d4089c Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Sat, 18 May 2019 00:07:09 -0100 Subject: [PATCH] add creation time on SocialAppNotification Signed-off-by: Maxence Lange --- lib/Interfaces/Internal/SocialAppNotificationInterface.php | 3 +++ lib/Interfaces/Object/FollowInterface.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Interfaces/Internal/SocialAppNotificationInterface.php b/lib/Interfaces/Internal/SocialAppNotificationInterface.php index 0d7ef9c4..0c05eb4c 100644 --- a/lib/Interfaces/Internal/SocialAppNotificationInterface.php +++ b/lib/Interfaces/Internal/SocialAppNotificationInterface.php @@ -110,6 +110,9 @@ class SocialAppNotificationInterface implements IActivityPubInterface { return; } + $notification->setPublished(date("c")); + $notification->convertPublished(); + $this->miscService->log('Generating notification: ' . json_encode($notification, JSON_UNESCAPED_SLASHES), 1); $this->streamRequest->save($notification); } diff --git a/lib/Interfaces/Object/FollowInterface.php b/lib/Interfaces/Object/FollowInterface.php index af43f3b8..6f45cf82 100644 --- a/lib/Interfaces/Object/FollowInterface.php +++ b/lib/Interfaces/Object/FollowInterface.php @@ -254,13 +254,15 @@ class FollowInterface implements IActivityPubInterface { * @param Follow $follow * * @throws ItemUnknownException + * @throws SocialAppConfigException */ private function generateNotification(Follow $follow) { /** @var SocialAppNotificationInterface $notificationInterface */ $notificationInterface = AP::$activityPub->getInterfaceFromType(SocialAppNotification::TYPE); - $notification = new SocialAppNotification(); + /** @var SocialAppNotification $notification */ + $notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE); $notification->setAttributedTo($follow->getActorId()) ->setId($follow->getId() . '/notification') ->setSummary('{actor} is following you')