summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-05-18 00:07:09 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-05-18 00:07:09 -0100
commitae4ba193b86e4316cbedc3c562af2f78c5d4089c (patch)
treedc0c4100c76c5ddeed4c77c268e1970e82155aeb
parenta9e46125cca4dd57c43cbeaf0d68493d0f950a8c (diff)
add creation time on SocialAppNotification
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Interfaces/Internal/SocialAppNotificationInterface.php3
-rw-r--r--lib/Interfaces/Object/FollowInterface.php4
2 files changed, 6 insertions, 1 deletions
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')