]> git.mxchange.org Git - friendica.git/commitdiff
Only share from federated posts
authorMichael <heluecht@pirati.ca>
Sat, 22 Apr 2023 10:40:58 +0000 (10:40 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 22 Apr 2023 10:40:58 +0000 (10:40 +0000)
src/Module/Post/Share.php
src/Object/Post.php

index 78ea1c63156ac6d239e81ae3bc9b817fc10fa0eb..db95c38c947215d2e7d36e21df88d8099a404a28 100644 (file)
@@ -68,7 +68,7 @@ class Share extends \Friendica\BaseModule
                $shared = $this->contentItem->getSharedPost($item, ['uri']);
                if ($shared && empty($shared['comment'])) {
                        $content = '[share]' . $shared['post']['uri'] . '[/share]';
-               } elseif ($item['network'] == Protocol::FEED) {
+               } elseif (!empty($item['plink']) && !in_array($item['network'], Protocol::FEDERATED)) {
                        $content = '[attachment]' . $item['plink'] . '[/attachment]';
                } else {
                        $content = '[share]' . $item['uri'] . '[/share]';
index 17c0c1f68e640b7ec608a969e8741cd800b66e9c..b34f5137785e7852b2505febd1b4e5bdf934d84c 100644 (file)
@@ -205,8 +205,9 @@ class Post
                $lock      = ($item['private'] == Item::PRIVATE) ? $privacy : false;
                $connector = !in_array($item['network'], Protocol::NATIVE_SUPPORT) ? DI::l10n()->t('Connector Message') : false;
 
-               $shareable = in_array($conv->getProfileOwner(), [0, DI::userSession()->getLocalUserId()]) && $item['private'] != Item::PRIVATE;
-               $announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER]);
+               $shareable    = in_array($conv->getProfileOwner(), [0, DI::userSession()->getLocalUserId()]) && $item['private'] != Item::PRIVATE;
+               $announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER, Protocol::TUMBLR]);
+               $commentable  = ($item['network'] != Protocol::TUMBLR);
 
                // On Diaspora only toplevel posts can be reshared
                if ($announceable && ($item['network'] == Protocol::DIASPORA) && ($item['gravity'] != Item::GRAVITY_PARENT)) {
@@ -392,7 +393,11 @@ class Post
                        }
                }
 
-               $comment_html = $this->getCommentBox($indent);
+               if ($commentable) {
+                       $comment_html = $this->getCommentBox($indent);
+               } else {
+                       $comment_html = '';
+               }
 
                if (strcmp(DateTimeFormat::utc($item['created']), DateTimeFormat::utc('now - 12 hours')) > 0) {
                        $shiny = 'shiny';