]> git.mxchange.org Git - friendica-addons.git/commitdiff
Bluesky: Added support for sensitive posts
authorMichael <heluecht@pirati.ca>
Sat, 23 Mar 2024 06:59:13 +0000 (06:59 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 23 Mar 2024 21:05:54 +0000 (21:05 +0000)
bluesky/bluesky.php

index 2cd2d263c6b691811d19f4178395b23512c1bc95..4a1f4f601df3f40e76fb82a1058069427fe32c96 100644 (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;
 }