From 4a3dfc19379156c64d32235fe88553b614089ea2 Mon Sep 17 00:00:00 2001 From: KMY Date: Sun, 22 Oct 2023 09:36:04 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20=E3=83=95=E3=83=AC=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E9=96=93=E3=81=A7=E7=B7=A8?= =?UTF-8?q?=E9=9B=86=E3=81=8C=E6=A9=9F=E8=83=BD=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../status_update_distribution_worker.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/workers/activitypub/status_update_distribution_worker.rb b/app/workers/activitypub/status_update_distribution_worker.rb index a79ede2bf61104..ba47861248fe9b 100644 --- a/app/workers/activitypub/status_update_distribution_worker.rb +++ b/app/workers/activitypub/status_update_distribution_worker.rb @@ -26,4 +26,28 @@ def activity virtual_object: @status ) end + + def activity_for_misskey + ActivityPub::ActivityPresenter.new( + id: [ActivityPub::TagManager.instance.uri_for(@status), '#updates/', @status.edited_at.to_i].join, + type: 'Update', + actor: ActivityPub::TagManager.instance.uri_for(@status.account), + published: @status.edited_at, + to: ActivityPub::TagManager.instance.to(@status), + cc: ActivityPub::TagManager.instance.cc_for_misskey(@status), + virtual_object: @status + ) + end + + def activity_for_friend + ActivityPub::ActivityPresenter.new( + id: [ActivityPub::TagManager.instance.uri_for(@status), '#updates/', @status.edited_at.to_i].join, + type: 'Update', + actor: ActivityPub::TagManager.instance.uri_for(@status.account), + published: @status.edited_at, + to: ActivityPub::TagManager.instance.to_for_friend(@status), + cc: ActivityPub::TagManager.instance.cc(@status), + virtual_object: @status + ) + end end From 59d9462f3724205bb5a5af7aca98aae16780ad0f Mon Sep 17 00:00:00 2001 From: KMY Date: Sun, 22 Oct 2023 09:37:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../status_update_distribution_worker.rb | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/app/workers/activitypub/status_update_distribution_worker.rb b/app/workers/activitypub/status_update_distribution_worker.rb index ba47861248fe9b..a7081bed8e5e37 100644 --- a/app/workers/activitypub/status_update_distribution_worker.rb +++ b/app/workers/activitypub/status_update_distribution_worker.rb @@ -15,39 +15,27 @@ def perform(status_id, options = {}) protected - def activity + def build_activity(for_misskey: false, for_friend: false) ActivityPub::ActivityPresenter.new( id: [ActivityPub::TagManager.instance.uri_for(@status), '#updates/', @status.edited_at.to_i].join, type: 'Update', actor: ActivityPub::TagManager.instance.uri_for(@status.account), published: @status.edited_at, - to: ActivityPub::TagManager.instance.to(@status), - cc: ActivityPub::TagManager.instance.cc(@status), + to: for_friend ? ActivityPub::TagManager.instance.to_for_friend(@status) : ActivityPub::TagManager.instance.to(@status), + cc: for_misskey ? ActivityPub::TagManager.instance.cc_for_misskey : ActivityPub::TagManager.instance.cc(@status), virtual_object: @status ) end + def activity + build_activity + end + def activity_for_misskey - ActivityPub::ActivityPresenter.new( - id: [ActivityPub::TagManager.instance.uri_for(@status), '#updates/', @status.edited_at.to_i].join, - type: 'Update', - actor: ActivityPub::TagManager.instance.uri_for(@status.account), - published: @status.edited_at, - to: ActivityPub::TagManager.instance.to(@status), - cc: ActivityPub::TagManager.instance.cc_for_misskey(@status), - virtual_object: @status - ) + build_activity(for_misskey: true) end def activity_for_friend - ActivityPub::ActivityPresenter.new( - id: [ActivityPub::TagManager.instance.uri_for(@status), '#updates/', @status.edited_at.to_i].join, - type: 'Update', - actor: ActivityPub::TagManager.instance.uri_for(@status.account), - published: @status.edited_at, - to: ActivityPub::TagManager.instance.to_for_friend(@status), - cc: ActivityPub::TagManager.instance.cc(@status), - virtual_object: @status - ) + build_activity(for_friend: true) end end