]> git.mxchange.org Git - friendica.git/commitdiff
Prevent prepending implicit mention if replied to item is ours in Protocol\Diaspora
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 14 Sep 2019 21:38:05 +0000 (17:38 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 14 Sep 2019 21:42:02 +0000 (17:42 -0400)
src/Protocol/Diaspora.php

index f0fcddc9a8a6287936f712a40c0ef5c7c20fce2a..5da1aac2462e49b3af26e4f1ef8746ba181f09d8 100644 (file)
@@ -3850,7 +3850,7 @@ class Diaspora
                        return $result;
                }
 
-               $toplevel_item = Item::selectFirst(['guid', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]);
+               $toplevel_item = Item::selectFirst(['guid', 'author-id', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]);
                if (!DBA::isResult($toplevel_item)) {
                        Logger::error('Missing parent conversation item', ['parent' => $item["parent"]]);
                        return false;
@@ -3858,12 +3858,18 @@ class Diaspora
 
                $thread_parent_item = $toplevel_item;
                if ($item['thr-parent'] != $item['parent-uri']) {
-                       $thread_parent_item = Item::selectFirst(['guid', 'author-link'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]);
+                       $thread_parent_item = Item::selectFirst(['guid', 'author-id', 'author-link'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]);
                }
 
                $body = $item["body"];
 
-               if ((empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions'))
+               // The replied to autor mention is prepended for clarity if:
+               // - Item replied isn't yours
+               // - Item is public or explicit mentions are disabled
+               // - Implicit mentions are enabled
+               if (
+                       $owner['id'] != $thread_parent_item['author-id']
+                       && (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions'))
                        && !Config::get('system', 'disable_implicit_mentions')
                ) {
                        $body = self::prependParentAuthorMention($body, $thread_parent_item['author-link']);