]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Post/Share.php
Merge branch 'friendica:develop' into mastodon-edit-title-spoiler-update
[friendica.git] / src / Module / Post / Share.php
index df15dbbef99cbe9a821dd247d3624092583382c0..78ea1c63156ac6d239e81ae3bc9b817fc10fa0eb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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;
@@ -47,7 +48,7 @@ class Share extends \Friendica\BaseModule
        public function __construct(Content\Item $contentItem, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
                parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
-               
+
                $this->session     = $session;
                $this->contentItem = $contentItem;
        }
@@ -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]';
                }