Commit 0b5bc62b authored by lain's avatar lain

Don't save double tags in AP objects we create

This crashed Mastodon workers.
parent 06c97f21
......@@ -133,7 +133,7 @@ def make_note_data(
"context" => context,
"attachment" => attachments,
"actor" => actor,
"tag" => tags |> Enum.map(fn {_, tag} -> tag end)
"tag" => tags |> Enum.map(fn {_, tag} -> tag end) |> Enum.uniq()
}
if inReplyTo do
......
defmodule Pleroma.Web.CommonAPI.UtilsTest do
use Pleroma.DataCase
alias Pleroma.Web.CommonAPI
import Pleroma.Factory
test "it de-duplicates tags" do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu #2HU"})
assert activity.data["object"]["tag"] == ["2hu"]
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment