diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index c331590b55..3973690c00 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -323,8 +323,13 @@ class Status extends BaseFactory { if (empty($item['quote-uri-id'])) { $media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]); - if (!empty($media) && $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]])) { - $quote_id = $shared_item['uri-id']; + if (!empty($media)) { + if (!empty($media['media-uri-id'])) { + $quote_id = $media['media-uri-id']; + } else { + $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]]); + $quote_id = $shared_item['uri-id'] ?? 0; + } } } else { $quote_id = $item['quote-uri-id']; diff --git a/src/Model/Item.php b/src/Model/Item.php index 8479c1a6d2..a730404ed4 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3044,7 +3044,12 @@ class Item } elseif (empty($shared_item['uri-id']) && empty($item['quote-uri-id']) && ($item['network'] != Protocol::DIASPORA)) { $media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]); if (!empty($media)) { - $shared_item = Post::selectFirst($fields, ['plink' => $media[0]['url'], 'uid' => [$item['uid'], 0]]); + $shared_item = Post::selectFirst($fields, ['uri-id' => $media[0]['media-uri-id'], 'uid' => [$item['uid'], 0]]); + if (empty($shared_item['uri-id'])) { + $shared_item = Post::selectFirst($fields, ['plink' => $media[0]['url'], 'uid' => [$item['uid'], 0]]); + } elseif (strtolower($shared['post']['uri']) != strtolower($media[0]['url'])) { + $shared_links[] = strtolower($media[0]['url']); + } if (empty($shared_item['uri-id'])) { $shared_item = Post::selectFirst($fields, ['uri' => $media[0]['url'], 'uid' => [$item['uid'], 0]]); diff --git a/src/Module/Media/Photo/Upload.php b/src/Module/Media/Photo/Upload.php index 1283b7cf34..988fd652e4 100644 --- a/src/Module/Media/Photo/Upload.php +++ b/src/Module/Media/Photo/Upload.php @@ -222,7 +222,7 @@ class Upload extends \Friendica\BaseModule } $this->logger->info('upload done'); - $this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $owner['nickname'] . '/image/' . $resource_id . '][img]' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "[/img][/url]\n\n"); + $this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $owner['nickname'] . '/image/' . $resource_id . '][img=' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "][/img][/url]\n\n"); } /**