]> git.mxchange.org Git - friendica.git/commitdiff
Issue 12189: Quote share a feed now shares the linked feed url
authorMichael <heluecht@pirati.ca>
Thu, 24 Nov 2022 06:36:08 +0000 (06:36 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 24 Nov 2022 06:36:08 +0000 (06:36 +0000)
mod/item.php
src/Module/Post/Share.php

index 924059df815b4f00637a35e59c22e3328c7475fd..e23e9fb4c4fa86814c4c4b367434c5de5ec49d6e 100644 (file)
@@ -239,6 +239,8 @@ function item_post(App $a) {
 
                $att_bbcode = "\n" . PageInfo::getFooterFromData($attachment);
                $body .= $att_bbcode;
+       } elseif (preg_match("/\[attachment\](.*?)\[\/attachment\]/ism", $body, $matches)) {
+               $body = preg_replace("/\[attachment].*?\[\/attachment\]/ism", PageInfo::getFooterFromUrl($matches[1]), $body);
        }
 
        // Convert links with empty descriptions to links without an explicit description
index d2a36e32b3d0b49c763f16d746217332182c8c3d..264c4693d7b96819ea4940e9a62941ff8a6c0ae1 100644 (file)
@@ -24,6 +24,7 @@ namespace Friendica\Module\Post;
 use Friendica\App;
 use Friendica\Content;
 use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
 use Friendica\Core\Session\Capability\IHandleUserSessions;
 use Friendica\Core\System;
 use Friendica\Model\Item;
@@ -59,7 +60,7 @@ class Share extends \Friendica\BaseModule
                        System::httpError(403);
                }
 
-               $item = Post::selectFirst(['private', 'body', 'uri'], ['id' => $post_id]);
+               $item = Post::selectFirst(['private', 'body', 'uri', 'plink', 'network'], ['id' => $post_id]);
                if (!$item || $item['private'] == Item::PRIVATE) {
                        System::httpError(404);
                }
@@ -67,6 +68,8 @@ 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) {
+                       $content = '[attachment]' . $item['plink'] . '[/attachment]';
                } else {
                        $content = '[share]' . $item['uri'] . '[/share]';
                }