mirror of
https://github.com/friendica/friendica
synced 2024-12-23 14:40:16 +00:00
Handling media in shared posts
This commit is contained in:
parent
e9fe92a5d7
commit
975c32116d
1 changed files with 17 additions and 0 deletions
|
@ -24,6 +24,7 @@ namespace Friendica\Factory\Api\Mastodon;
|
|||
use Friendica\App\BaseURL;
|
||||
use Friendica\BaseFactory;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -91,6 +92,22 @@ class Status extends BaseFactory
|
|||
$card = DI::mstdnCard()->createFromUriId($uriId);
|
||||
$attachments = DI::mstdnAttachment()->createFromUriId($uriId);
|
||||
|
||||
$shared = BBCode::fetchShareAttributes($item['body']);
|
||||
if (!empty($shared['guid'])) {
|
||||
$shared_item = Post::selectFirst(['uri-id', 'plink'], ['guid' => $shared['guid']]);
|
||||
|
||||
$shared_uri_id = $shared_item['uri-id'] ?? 0;
|
||||
|
||||
$mentions = array_merge($mentions, DI::mstdnMention()->createFromUriId($shared_uri_id));
|
||||
$tags = array_merge($tags, DI::mstdnTag()->createFromUriId($shared_uri_id));
|
||||
$attachments = array_merge($attachments, DI::mstdnAttachment()->createFromUriId($shared_uri_id));
|
||||
|
||||
if (empty($card->toArray())) {
|
||||
$card = DI::mstdnCard()->createFromUriId($shared_uri_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($item['vid'] == Verb::getID(Activity::ANNOUNCE)) {
|
||||
$reshare = $this->createFromUriId($item['thr-parent-id'], $uid)->toArray();
|
||||
$reshared_item = Post::selectFirst(['title', 'body'], ['uri-id' => $item['thr-parent-id'], 'uid' => [0, $uid]]);
|
||||
|
|
Loading…
Reference in a new issue