summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-09-26 11:27:00 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-09-27 20:00:47 +0200
commiteebe33e86a064f8dff43663af634f101d25f88b3 (patch)
tree2a05b697c480df842f0243a985cec01d98302a80 /lib
parentf3291acc9181dcc365aaca583ae3fb1ff57019d1 (diff)
downloadpleroma-eebe33e86a064f8dff43663af634f101d25f88b3.tar.gz
pleroma-eebe33e86a064f8dff43663af634f101d25f88b3.zip
transmogrifier: Add support for array-less hashtags, add broken announce, harden get_actor
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 291d7d169..704c76f70 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -21,13 +21,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
if is_binary(Enum.at(actor, 0)) do
Enum.at(actor, 0)
else
- Enum.find(actor, fn %{"type" => type} -> type == "Person" end)
+ Enum.find(actor, fn %{"type" => type} -> type in ["Person", "Service", "Application"] end)
|> Map.get("id")
end
end
- def get_actor(%{"actor" => actor}) when is_map(actor) do
- actor["id"]
+ def get_actor(%{"actor" => %{"id" => id}}) when is_bitstring(id) do
+ id
end
@doc """
@@ -206,8 +206,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|> Map.put("tag", combined)
end
- def fix_tag(%{"tag" => %{"type" => "Hashtag"} = tag} = object) do
- combined = [tag ++ String.slice(tag["name"], 1..-1)]
+ def fix_tag(%{"tag" => %{"type" => "Hashtag", "name" => hashtag} = tag} = object) do
+ combined = [tag, String.slice(hashtag, 1..-1)]
object
|> Map.put("tag", combined)