Merge pull request 'Bluesky: Fix for quoted posts with media' (#1403) from heluecht/friendica-addons:bluesky-quote into develop

Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1403
pull/558/head
Hypolite Petovan 2023-07-09 15:49:48 +02:00
commit a52fa4dfb0
1 changed files with 5 additions and 5 deletions

View File

@ -1150,16 +1150,12 @@ function bluesky_add_media(stdClass $embed, array $item, int $fetch_uid, int $le
$shared = bluesky_get_header($embed->record->record, $uri, 0, $fetch_uid); $shared = bluesky_get_header($embed->record->record, $uri, 0, $fetch_uid);
$shared = bluesky_get_content($shared, $embed->record->record->value, $uri, $item['uid'], $level); $shared = bluesky_get_content($shared, $embed->record->record->value, $uri, $item['uid'], $level);
if (!empty($shared)) { if (!empty($shared)) {
if (!empty($embed->record->embeds)) { if (!empty($embed->record->record->embeds)) {
foreach ($embed->record->record->embeds as $single) { foreach ($embed->record->record->embeds as $single) {
$shared = bluesky_add_media($single, $shared, $fetch_uid, $level); $shared = bluesky_add_media($single, $shared, $fetch_uid, $level);
} }
} }
if (!empty($embed->media)) {
bluesky_add_media($embed->media, $item, $fetch_uid, $level);
}
$id = Item::insert($shared); $id = Item::insert($shared);
$shared = Post::selectFirst(['uri-id'], ['id' => $id]); $shared = Post::selectFirst(['uri-id'], ['id' => $id]);
} }
@ -1167,6 +1163,10 @@ function bluesky_add_media(stdClass $embed, array $item, int $fetch_uid, int $le
if (!empty($shared)) { if (!empty($shared)) {
$item['quote-uri-id'] = $shared['uri-id']; $item['quote-uri-id'] = $shared['uri-id'];
} }
if (!empty($embed->media)) {
bluesky_add_media($embed->media, $item, $fetch_uid, $level);
}
break; break;
default: default: