Add anonymous emoji patch

This commit is contained in:
Oneric 2024-10-03 21:22:28 +02:00
parent e89f927929
commit 54a30ff6d5
2 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,66 @@
From 4ff52930936699161223b12c4396d5a5ad6736d4 Mon Sep 17 00:00:00 2001
From: Oneric <oneric@oneric.stub>
Date: Sun, 23 Jun 2024 20:46:58 +0200
Subject: [PATCH] Federate emoji as anonymous objects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Usually an id should point to another AP object
and the image file isnt an AP object. We currently
do not provide standalone AP objects for emoji and
don't keep track of remote emoji at all.
Thus just federate them as anonymous objects,
i.e. objects only existing within a parent context
and using an explicit null id.
IceShrimp.NET previously adopted anonymous objects
for remote emoji without any apparent issues. See:
https://iceshrimp.dev/iceshrimp/Iceshrimp.NET/commit/333611f65eb2a65b2779ece0435b5ba84bf60e99
Fixes: https://akkoma.dev/AkkomaGang/akkoma/issues/694
---
lib/pleroma/web/activity_pub/transmogrifier.ex | 2 +-
.../web/activity_pub/transmogrifier/note_handling_test.exs | 2 +-
test/pleroma/web/activity_pub/views/user_view_test.exs | 2 +-
4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index ca5e85f2e..75c1f0f0c 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -951,7 +951,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
"name" => ":" <> name <> ":",
"type" => "Emoji",
"updated" => "1970-01-01T00:00:00Z",
- "id" => url
+ "id" => nil
}
end
diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
index 16ee31483..c8aa2a1ed 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
@@ -700,7 +700,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
assert Transmogrifier.take_emoji_tags(user) == [
%{
"icon" => %{"type" => "Image", "url" => "https://example.org/firefox.png"},
- "id" => "https://example.org/firefox.png",
+ "id" => nil,
"name" => ":firefox:",
"type" => "Emoji",
"updated" => "1970-01-01T00:00:00Z"
diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs
index abe91cdea..2a367b680 100644
--- a/test/pleroma/web/activity_pub/views/user_view_test.exs
+++ b/test/pleroma/web/activity_pub/views/user_view_test.exs
@@ -43,7 +43,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
"tag" => [
%{
"icon" => %{"type" => "Image", "url" => "/test"},
- "id" => "/test",
+ "id" => nil,
"name" => ":bib:",
"type" => "Emoji",
"updated" => "1970-01-01T00:00:00Z"

View file

@ -11,3 +11,5 @@ pr814_09_fix-multi-selection-poll-counts.patch
pr814_10_fix-swagger-ui.patch
# Preserve math markup from other instances
pr642_receive-mathml.patch
# Don't federate bogus emoji ID; just use anonymous object
pr815_federate-anonymous-emoji.patch