summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index af6b5befc..3781b212a 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -100,6 +100,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
"""
def prepare_outgoing(%{"type" => "Create", "object" => %{"type" => "Note"} = object} = data) do
object = object
+ |> add_hashtags
|> add_mention_tags
|> add_attributed_to
|> prepare_attachments
@@ -118,6 +119,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
{:ok, data}
end
+ def add_hashtags(object) do
+ tags = (object["tag"] || [])
+ |> Enum.map fn (tag) -> %{"href" => Pleroma.Web.Endpoint.url() <> "/tags/#{tag}", "name" => "##{tag}", "type" => "Hashtag"} end
+
+ object
+ |> Map.put("tag", tags)
+ end
+
def add_mention_tags(object) do
mentions = object["to"]
|> Enum.map(fn (ap_id) -> User.get_cached_by_ap_id(ap_id) end)