mirror of
https://github.com/friendica/friendica
synced 2024-12-23 18:00:17 +00:00
Transmit shared attachments via ActivityPub
This commit is contained in:
parent
b88c9f9d67
commit
7c80f513d5
1 changed files with 23 additions and 10 deletions
|
@ -1291,23 +1291,36 @@ class Transmitter
|
||||||
$attachments[] = $attachment;
|
$attachments[] = $attachment;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
|
$uriids = [$item['uri-id']];
|
||||||
|
$shared = BBCode::fetchShareAttributes($item['body']);
|
||||||
|
if (!empty($shared['guid'])) {
|
||||||
|
$shared_item = Post::selectFirst(['uri-id'], ['guid' => $shared['guid']]);
|
||||||
|
if (!empty($shared_item['uri-id'])) {
|
||||||
|
$uriids[] = $shared_item['uri-id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($uriids as $uriid) {
|
||||||
|
foreach (Post\Media::getByURIId($uriid, [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
|
||||||
$attachments[] = ['type' => 'Document',
|
$attachments[] = ['type' => 'Document',
|
||||||
'mediaType' => $attachment['mimetype'],
|
'mediaType' => $attachment['mimetype'],
|
||||||
'url' => $attachment['url'],
|
'url' => $attachment['url'],
|
||||||
'name' => $attachment['description']];
|
'name' => $attachment['description']];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($type != 'Note') {
|
if ($type != 'Note') {
|
||||||
return $attachments;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]) as $attachment) {
|
foreach ($uriids as $uriid) {
|
||||||
|
foreach (Post\Media::getByURIId($uriid, [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]) as $attachment) {
|
||||||
$attachments[] = ['type' => 'Document',
|
$attachments[] = ['type' => 'Document',
|
||||||
'mediaType' => $attachment['mimetype'],
|
'mediaType' => $attachment['mimetype'],
|
||||||
'url' => $attachment['url'],
|
'url' => $attachment['url'],
|
||||||
'name' => $attachment['description']];
|
'name' => $attachment['description']];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $attachments;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue