diff options
author | rinpatch <rinpatch@sdf.org> | 2020-10-23 19:39:42 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-10-23 19:39:42 +0000 |
commit | df610714225e5f149009fd4bdf393a28817d861d (patch) | |
tree | 3425de5d83c44b7706a726ae2b1d6be05cbe058e /lib | |
parent | 096e4518adf176c3f9cee0e38319340249083a48 (diff) | |
parent | e97b254c6bb798d200f381e5adbde2177bcbc0df (diff) | |
download | pleroma-df610714225e5f149009fd4bdf393a28817d861d.tar.gz pleroma-df610714225e5f149009fd4bdf393a28817d861d.zip |
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 |