]> git.mxchange.org Git - friendica.git/commitdiff
No implicit mention for top level Diaspora comments
authorMichael <heluecht@pirati.ca>
Tue, 16 Feb 2021 07:20:41 +0000 (07:20 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 16 Feb 2021 07:20:41 +0000 (07:20 +0000)
src/Object/Post.php
src/Protocol/Diaspora.php

index d2c0b31e102b436e60adb731fb4ff93bba94d662..156b602e90575b5e8c1eb07a2d4ce29cf85871a0 100644 (file)
@@ -881,13 +881,13 @@ class Post
                        return '';
                }
 
-               $item = PostModel::selectFirst(['author-addr', 'uri-id'], ['id' => $this->getId()]);
+               $item = PostModel::selectFirst(['author-addr', 'uri-id', 'network', 'gravity'], ['id' => $this->getId()]);
                if (!DBA::isResult($item) || empty($item['author-addr'])) {
                        // Should not happen
                        return '';
                }
 
-               if ($item['author-addr'] != $owner['addr']) {
+               if (($item['author-addr'] != $owner['addr']) && (($item['gravity'] != GRAVITY_PARENT) || !in_array($item['network'], [Protocol::DIASPORA]))) {
                        $text = '@' . $item['author-addr'] . ' ';
                } else {
                        $text = '';
index 7ba385b6e9b0e2e61fe6f4e466e23d256b143784..14c8df1a7815c8867e71373771e77f669c2d3317 100644 (file)
@@ -3599,7 +3599,7 @@ class Diaspora
                        return $result;
                }
 
-               $toplevel_item = Post::selectFirst(['guid', 'author-id', 'author-link'], ['id' => $item['parent'], 'parent' => $item['parent']]);
+               $toplevel_item = Post::selectFirst(['guid', 'author-id', 'author-link', 'gravity'], ['id' => $item['parent'], 'parent' => $item['parent']]);
                if (!DBA::isResult($toplevel_item)) {
                        Logger::error('Missing parent conversation item', ['parent' => $item['parent']]);
                        return false;
@@ -3607,7 +3607,7 @@ class Diaspora
 
                $thread_parent_item = $toplevel_item;
                if ($item['thr-parent'] != $item['parent-uri']) {
-                       $thread_parent_item = Post::selectFirst(['guid', 'author-id', 'author-link'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]);
+                       $thread_parent_item = Post::selectFirst(['guid', 'author-id', 'author-link', 'gravity'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]);
                }
 
                $body = $item["body"];
@@ -3618,6 +3618,7 @@ class Diaspora
                // - Implicit mentions are enabled
                if (
                        $item['author-id'] != $thread_parent_item['author-id']
+                       && ($thread_parent_item['gravity'] != GRAVITY_PARENT)
                        && (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions'))
                        && !DI::config()->get('system', 'disable_implicit_mentions')
                ) {