diff options
author | rinpatch <rinpatch@sdf.org> | 2020-10-23 19:39:42 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-11-05 16:19:44 +0300 |
commit | 5f27a39152cfee4746313ee8c63fb5f600fdb1a2 (patch) | |
tree | 9064821508d523e5cef2a07f6ca31544936f294d /lib | |
parent | 88dc1d24b98a9cac9f740fcd12b38a2d7727a9c2 (diff) | |
download | pleroma-5f27a39152cfee4746313ee8c63fb5f600fdb1a2.tar.gz |
Merge branch '2242-nsfw-case' into 'develop'
Resolve "Posts tagged with #NSFW from GS aren't marked as sensitive"
Closes #2242
See merge request pleroma/pleroma!3094
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index d7dd9fe6b..39c8f7e39 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -40,6 +40,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do |> fix_in_reply_to(options) |> fix_emoji |> fix_tag + |> set_sensitive |> fix_content_map |> fix_addressing |> fix_summary @@ -313,19 +314,21 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do tags = tag |> Enum.filter(fn data -> data["type"] == "Hashtag" and data["name"] end) - |> Enum.map(fn data -> String.slice(data["name"], 1..-1) end) + |> Enum.map(fn %{"name" => name} -> + name + |> String.slice(1..-1) + |> String.downcase() + end) Map.put(object, "tag", tag ++ tags) end - def fix_tag(%{"tag" => %{"type" => "Hashtag", "name" => hashtag} = tag} = object) do - combined = [tag, String.slice(hashtag, 1..-1)] - - Map.put(object, "tag", combined) + def fix_tag(%{"tag" => %{} = tag} = object) do + object + |> Map.put("tag", [tag]) + |> fix_tag end - def fix_tag(%{"tag" => %{} = tag} = object), do: Map.put(object, "tag", [tag]) - def fix_tag(object), do: object # content map usually only has one language so this will do for now. @@ -927,7 +930,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do Map.put(object, "conversation", object["context"]) end - def set_sensitive(%{"sensitive" => true} = object) do + def set_sensitive(%{"sensitive" => _} = object) do object end |