Change check for friendica-title key to use isa and always set

This commit is contained in:
Hank Grabowski 2023-02-18 10:07:08 -05:00
parent f10821f915
commit 4b2ee284d8

View file

@ -209,13 +209,10 @@ class Statuses extends BaseApi
$item['quote-uri-id'] = $request['quote_id']; $item['quote-uri-id'] = $request['quote_id'];
} }
$has_title = array_key_exists('title', $request['friendica']); $item['title'] = $request['friendica']['title'] ?? '';
if ($has_title != null && !$request['in_reply_to_id']) {
$item['title'] = $request['friendica']['title'];
}
if (!empty($request['spoiler_text'])) { if (!empty($request['spoiler_text'])) {
if (!$has_title && !$request['in_reply_to_id'] && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) { if (!isset($request['friendica']['title']) && !$request['in_reply_to_id'] && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) {
$item['title'] = $request['spoiler_text']; $item['title'] = $request['spoiler_text'];
} else { } else {
$item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body']; $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body'];