]> git.mxchange.org Git - friendica.git/commitdiff
Fix link to post in notification
authorMichael <heluecht@pirati.ca>
Sun, 20 Mar 2022 19:59:35 +0000 (19:59 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 20 Mar 2022 19:59:35 +0000 (19:59 +0000)
src/Navigation/Notifications/Factory/Notification.php

index 4e40972eeb2a9120cd67f9742626e7b6712a97ff..ea74357c03c79d1553d473e3ee750f802b34a604 100644 (file)
@@ -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])) {