Fix formatting.

This commit is contained in:
lain 2018-04-24 21:25:31 +02:00
parent 7a52c4549c
commit c78e7d8b11
1 changed files with 12 additions and 4 deletions

View File

@ -24,7 +24,9 @@ defp check_media_removal(actor_info, object) do
@media_nsfw Keyword.get(@mrf_policy, :media_nsfw) @media_nsfw Keyword.get(@mrf_policy, :media_nsfw)
defp check_media_nsfw(actor_info, object) do defp check_media_nsfw(actor_info, object) do
child_object = object["object"] child_object = object["object"]
if actor_info.host in @media_nsfw and child_object["attachment"] != nil and length(child_object["attachment"]) > 0 do
if actor_info.host in @media_nsfw and child_object["attachment"] != nil and
length(child_object["attachment"]) > 0 do
tags = (child_object["tag"] || []) ++ ["nsfw"] tags = (child_object["tag"] || []) ++ ["nsfw"]
child_object = Map.put(child_object, "tags", tags) child_object = Map.put(child_object, "tags", tags)
child_object = Map.put(child_object, "sensitive", true) child_object = Map.put(child_object, "sensitive", true)
@ -40,9 +42,15 @@ defp check_ftl_removal(actor_info, object) do
user = User.get_by_ap_id(object["actor"]) user = User.get_by_ap_id(object["actor"])
# flip to/cc relationship to make the post unlisted # flip to/cc relationship to make the post unlisted
if "https://www.w3.org/ns/activitystreams#Public" in object["to"] and user.follower_address in object["cc"] do if "https://www.w3.org/ns/activitystreams#Public" in object["to"] and
to = List.delete(object["to"], "https://www.w3.org/ns/activitystreams#Public") ++ [user.follower_address] user.follower_address in object["cc"] do
cc = List.delete(object["cc"], user.follower_address) ++ ["https://www.w3.org/ns/activitystreams#Public"] to =
List.delete(object["to"], "https://www.w3.org/ns/activitystreams#Public") ++
[user.follower_address]
cc =
List.delete(object["cc"], user.follower_address) ++
["https://www.w3.org/ns/activitystreams#Public"]
object = Map.put(object, "to", to) object = Map.put(object, "to", to)
object = Map.put(object, "cc", cc) object = Map.put(object, "cc", cc)