Commit 8d4b661e authored by lain's avatar lain
Browse files

Transmogrifier: Strip internal emoji reaction fields.

parent 05e97765
......@@ -995,9 +995,11 @@ def prepare_attachments(object) do
|> Map.put("attachment", attachments)
defp strip_internal_fields(object) do
def strip_internal_fields(object) do
|> Map.drop([
......@@ -491,6 +491,20 @@ test "it strips internal likes" do
refute Map.has_key?(, "likes")
test "it strips internal reactions" do
user = insert(:user)
{:ok, activity} =, %{"status" => "#cofe"})
{:ok, _, _} = CommonAPI.react_with_emoji(, user, "📢")
%{object: object} = Activity.get_by_id_with_object(
assert Map.has_key?(, "reactions")
assert Map.has_key?(, "reaction_count")
object_data = Transmogrifier.strip_internal_fields(
refute Map.has_key?(object_data, "reactions")
refute Map.has_key?(object_data, "reaction_count")
test "it works for incoming update activities" do
data =!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
Supports Markdown
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