Encapsulation of tags / hashtags fetching from objects.

This commit is contained in:
Ivan Tashkinov 2020-12-21 22:54:26 +03:00
commit ee221277b0
12 changed files with 78 additions and 39 deletions

View file

@ -39,7 +39,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
object = Object.normalize(data["object"])
assert "test" in object.data["tag"]
assert "test" in Object.tags(object)
assert Object.hashtags(object) == ["test"]
end
test "it cleans up incoming notices which are not really DMs" do
@ -220,7 +221,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
object = Object.normalize(data["object"])
assert Enum.at(object.data["tag"], 2) == "moo"
assert Enum.at(Object.tags(object), 2) == "moo"
assert Object.hashtags(object) == ["moo"]
end
test "it works for incoming notices with contentMap" do

View file

@ -493,7 +493,7 @@ defmodule Pleroma.Web.CommonAPITest do
object = Object.normalize(activity)
assert object.data["tag"] == ["2hu"]
assert Object.tags(object) == ["2hu"]
end
test "it adds emoji in the object" do

View file

@ -262,8 +262,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
mentions: [],
tags: [
%{
name: "#{object_data["tag"]}",
url: "/tag/#{object_data["tag"]}"
name: "#{hd(object_data["tag"])}",
url: "/tag/#{hd(object_data["tag"])}"
}
],
application: %{