Merge pull request 'Bluesky: Added support for sensitive posts' (#1492) from heluecht/friendica-addons:sensitive into develop

Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1492
Reviewed-by: Hypolite Petovan <hypolite@mrpetovan.com>
pull/1494/head
Hypolite Petovan 2024-03-26 17:12:21 +01:00
commit aea944c8b5
1 changed files with 11 additions and 0 deletions

View File

@ -1222,6 +1222,17 @@ function bluesky_get_header(stdClass $post, string $uri, int $uid, int $fetch_ui
$item['post-reason'] = Item::PR_FOLLOWER;
}
if (!empty($post->labels)) {
foreach ($post->labels as $label) {
// Only flag posts as sensitive based on labels that had been provided by the author.
// When "ver" is set to "1" it was flagged by some automated process.
if (empty($label->ver)) {
$item['sensitive'] = true;
Logger::debug('Sensitive content', ['uri-id' => $item['uri-id'], 'label' => $label]);
}
}
}
return $item;
}