aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-02-14 00:27:35 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2019-02-14 00:35:53 +0000
commit94cbbb0e3a047c1d2851e2214b408dc19f569fbd (patch)
treea6f1cc60e4d0fc5fe28202062c613d5117c6c74a
parent99f955cd9e48ba956da438926dd8626fe43aa3a1 (diff)
downloadpleroma-94cbbb0e3a047c1d2851e2214b408dc19f569fbd.tar.gz
activitypub: transmogrifier: do not attempt to expand pre-existing AS2 tag objects
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 98a2af819..5da65fa39 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -765,12 +765,18 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
def add_hashtags(object) do
tags =
(object["tag"] || [])
- |> Enum.map(fn tag ->
- %{
- "href" => Pleroma.Web.Endpoint.url() <> "/tags/#{tag}",
- "name" => "##{tag}",
- "type" => "Hashtag"
- }
+ |> Enum.map(fn
+ # Expand internal representation tags into AS2 tags.
+ tag when is_binary(tag) ->
+ %{
+ "href" => Pleroma.Web.Endpoint.url() <> "/tags/#{tag}",
+ "name" => "##{tag}",
+ "type" => "Hashtag"
+ }
+
+ # Do not process tags which are already AS2 tag objects.
+ tag when is_map(tag) ->
+ tag
end)
object