diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index da4156c44..4cae9bc57 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -915,12 +915,12 @@ def set_conversation(object) do Map.put(object, "conversation", object["context"]) end - def set_sensitive(%{"sensitive" => _} = object) do + def set_sensitive(%{"sensitive" => sensitive} = object) when is_boolean(sensitive) do object end def set_sensitive(object) do - tags = object["tag"] || [] + tags = Object.hashtags(%Object{data: object}) Map.put(object, "sensitive", "nsfw" in tags) end diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index 09b5b3809..eea9443d7 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -39,7 +39,6 @@ test "it works for incoming notices with tag not being an array (kroeg)" do {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) object = Object.normalize(data["object"]) - assert "test" in Object.tags(object) assert Object.hashtags(object) == ["test"] end @@ -193,7 +192,7 @@ test "it works for incoming notices with hashtags" do "href" => "http://mastodon.example.org/tags/moo", "name" => "#moo", "type" => "Hashtag" - } == object.data["tag"] + } == Enum.at(object.data["tag"], 1) end test "it works for incoming notices with contentMap" do