Issue 13845: Support "sensitive" attribute

This commit is contained in:
Michael 2024-02-04 21:45:30 +00:00
parent d9d42105d6
commit 15df9990da
11 changed files with 53 additions and 28 deletions

View file

@ -1697,18 +1697,6 @@ class Transmitter
});
}
/**
* Returns if the post contains sensitive content ("nsfw")
*
* @param integer $uri_id URI id
* @return boolean Whether URI id was found
* @throws \Exception
*/
private static function isSensitive(int $uri_id): bool
{
return DBA::exists('tag-view', ['uri-id' => $uri_id, 'name' => 'nsfw', 'type' => Tag::HASHTAG]);
}
/**
* Creates event data
*
@ -1812,7 +1800,7 @@ class Transmitter
} else {
$data['attributedTo'] = $item['author-link'];
}
$data['sensitive'] = self::isSensitive($item['uri-id']);
$data['sensitive'] = (bool)$item['sensitive'];
if (!empty($item['conversation']) && ($item['conversation'] != './')) {
$data['conversation'] = $data['context'] = $item['conversation'];