From 4dace46159ea71c1904e75ead245c9fe47098d3b Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 20 Mar 2022 19:59:35 +0000 Subject: [PATCH] Fix link to post in notification --- src/Navigation/Notifications/Factory/Notification.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Navigation/Notifications/Factory/Notification.php b/src/Navigation/Notifications/Factory/Notification.php index 4e40972eeb..ea74357c03 100644 --- a/src/Navigation/Notifications/Factory/Notification.php +++ b/src/Navigation/Notifications/Factory/Notification.php @@ -141,7 +141,7 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow } $link_item = Post::selectFirstPost(['guid'], ['uri-id' => $Notification->targetUriId]); } else { - $item = Post::selectFirst([], ['uri-id' => $Notification->targetUriId, 'uid' => [0, $Notification->uid]], ['order' => ['uid' => true]]); + $link_item = $item = Post::selectFirst([], ['uri-id' => $Notification->targetUriId, 'uid' => [0, $Notification->uid]], ['order' => ['uid' => true]]); if (empty($item)) { $this->logger->info('Post not found', ['uri-id' => $Notification->targetUriId]); return $message; @@ -154,7 +154,10 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow return $message; } } - $link_item = $item; + + if (($Notification->verb != Activity::POST) || !in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT, Post\UserNotification::TYPE_IMPLICIT_TAGGED])) { + $link_item = $item; + } } if (in_array($Notification->type, [Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION, Post\UserNotification::TYPE_SHARED])) { -- 2.39.5