Merge pull request #7419 from lilithmooncohen/fix/reblog-media-attachments

Render boosts for clients that only read the top level
pull/7426/head
dansup 1 day ago committed by GitHub
commit 545ad821b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2796,7 +2796,8 @@ class ApiV1Controller extends Controller
return false;
}
$status['account'] = $account;
// Not $status['account'] = $account: $account is resolved from
// the row, StatusService picks the right one per client
if ($pid) {
$status['favourited'] = (bool) LikeService::liked($pid, $s['id']);
@ -2874,7 +2875,8 @@ class ApiV1Controller extends Controller
return false;
}
$status['account'] = $account;
// Not $status['account'] = $account: $account is resolved from
// the row, StatusService picks the right one per client
if ($pid) {
$status['favourited'] = (bool) LikeService::liked($pid, $s['id']);

@ -90,6 +90,20 @@ class StatusService
unset($res['_pid']);
}
// A client that resolves reblogs declares include_reblogs; one that
// only reads the top level renders a boost as an empty card, so give it
// the shared status there instead.
if (! $mastodonMode
&& request()->has('_pe')
&& ! request()->filled('include_reblogs')
&& ! empty($res['reblog'])) {
foreach (['account', 'content', 'content_text', 'emojis', 'media_attachments'] as $key) {
if (array_key_exists($key, $res['reblog'])) {
$res[$key] = $res['reblog'][$key];
}
}
}
return $res;
}

Loading…
Cancel
Save