mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-05-17 01:02:38 +00:00
Fixup tags
This commit is contained in:
parent
420efb844f
commit
6a1ad8dba4
|
@ -915,12 +915,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier 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
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest 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 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest 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
|
||||
|
|
Loading…
Reference in a new issue