From e7390317f5dca869b0bf5bb13a6d31650022a3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Wed, 8 Nov 2023 13:32:20 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Fix:=20=E3=83=AA=E3=83=A2=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=81=8B=E3=82=89=E6=9D=A5=E3=81=9F=E3=82=B9=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=81=AE=E4=BF=9D=E5=AD=98=E3=81=AB=E5=A4=B1=E6=95=97?= =?UTF-8?q?=E3=81=97=E3=81=9F=E6=99=82=E3=80=81Sidekiq=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=96=E3=81=8C=E5=86=8D=E8=A9=A6=E8=A1=8C=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=20(#257)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/activitypub/activity/like.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/activitypub/activity/like.rb b/app/lib/activitypub/activity/like.rb index cb39b91475..24db30a118 100644 --- a/app/lib/activitypub/activity/like.rb +++ b/app/lib/activitypub/activity/like.rb @@ -59,7 +59,7 @@ class ActivityPub::Activity::Like < ActivityPub::Activity forward_for_emoji_reaction relay_for_emoji_reaction end - rescue Seahorse::Client::NetworkingError + rescue Seahorse::Client::NetworkingError, ActiveRecord::RecordInvalid nil end From c35e5872c6de72565125a60655d336b45551bfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Thu, 9 Nov 2023 11:50:22 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Fix:=20#236=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=97=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84=E7=8A=B6?= =?UTF-8?q?=E6=85=8B=E3=81=A7=E6=8A=95=E7=A8=BF=E8=A9=B3=E7=B4=B0=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=A7=E3=82=B9=E3=82=BF=E3=83=B3=E3=83=97=E3=82=92?= =?UTF-8?q?=E6=8A=BC=E3=81=9D=E3=81=86=E3=81=A8=E3=81=99=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=8C=E6=93=8D=E4=BD=9C=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=8B=20(#258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/features/status/index.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/status/index.jsx b/app/javascript/mastodon/features/status/index.jsx index e739514849..adc45ae772 100644 --- a/app/javascript/mastodon/features/status/index.jsx +++ b/app/javascript/mastodon/features/status/index.jsx @@ -280,10 +280,13 @@ class Status extends ImmutablePureComponent { if (signedIn) { dispatch(emojiReact(status, emoji)); } else { - dispatch(openModal('INTERACTION', { - type: 'favourite', - accountId: status.getIn(['account', 'id']), - url: status.get('url'), + dispatch(openModal({ + modalType: 'INTERACTION', + modalProps: { + type: 'favourite', + accountId: status.getIn(['account', 'id']), + url: status.get('uri'), + }, })); } }; From 25adf2a8c949e0f6282ab8974b44ae3b9831ce21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Tue, 14 Nov 2023 09:19:53 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Fix:=20=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=81=A7=E3=82=B9=E3=82=BF=E3=83=B3=E3=83=97=E3=81=AE=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=97=E3=81=9F?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=80=81=E3=82=B9=E3=82=BF=E3=83=B3=E3=83=97?= =?UTF-8?q?=E3=81=A4=E3=81=91=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=AB=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=20(#290)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/emoji_reaction.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/emoji_reaction.rb b/app/models/emoji_reaction.rb index f97679347c..ff5cc08899 100644 --- a/app/models/emoji_reaction.rb +++ b/app/models/emoji_reaction.rb @@ -18,7 +18,7 @@ class EmojiReaction < ApplicationRecord include Paginable EMOJI_REACTION_LIMIT = 32_767 - EMOJI_REACTION_PER_ACCOUNT_LIMIT = ENV.fetch('EMOJI_REACTION_PER_ACCOUNT_LIMIT', 3) + EMOJI_REACTION_PER_ACCOUNT_LIMIT = ENV.fetch('EMOJI_REACTION_PER_ACCOUNT_LIMIT', 3).to_i update_index('statuses', :status) From 203617edaf844ff6de7b50484b1bd80c1c1603a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Fri, 17 Nov 2023 08:38:09 +0900 Subject: [PATCH 4/6] Release: 5.9 LTS (#278) --- lib/mastodon/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 2a1eb1785a..5840c6363e 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -9,7 +9,7 @@ module Mastodon end def kmyblue_minor - 8 + 9 end def kmyblue_flag From c95231d85396360d6728bb56544aead8744f82e7 Mon Sep 17 00:00:00 2001 From: KMY Date: Tue, 28 Nov 2023 12:13:05 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Change:=20=E3=82=B5=E3=83=BC=E3=82=AF?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E9=80=81=E3=82=8A=E5=85=88=E3=82=A2=E3=82=AB?= =?UTF-8?q?=E3=82=A6=E3=83=B3=E3=83=88=E6=8C=87=E5=AE=9A=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E3=82=92`account=5Fusername`=EF=BC=88Fedibird=E3=81=A8?= =?UTF-8?q?=E5=90=8C=E6=A7=98=EF=BC=89=E3=81=AB=E5=A4=89=E6=9B=B4=20(#283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change: サークルの送り先アカウント指定方法を`account_username`(Fedibirdと同様)に変更 * Test: テストを追加 * Maybe Fix: Fedibirdで自分限定と認識される問題 --- app/lib/activitypub/tag_manager.rb | 5 +--- app/lib/status_reach_finder.rb | 6 ++++ .../activitypub/distribution_worker.rb | 16 ++++++++++- .../activitypub/distribution_worker_spec.rb | 28 ++++++++++++++++++- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index f9b67867ef..52f7ed32ab 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -119,10 +119,7 @@ class ActivityPub::TagManager end.compact end when 'limited' - status.mentions.each_with_object([]) do |mention, result| - result << uri_for(mention.account) - result << followers_uri_for(mention.account) if mention.account.group? - end.compact + ['kmyblue:Limited'] # to avoid Fedibird personal visibility end end diff --git a/app/lib/status_reach_finder.rb b/app/lib/status_reach_finder.rb index 8639a30a9f..c7069c7dac 100644 --- a/app/lib/status_reach_finder.rb +++ b/app/lib/status_reach_finder.rb @@ -21,6 +21,12 @@ class StatusReachFinder end end + def inboxes_for_limited + DeliveryFailureTracker.without_unavailable( + @status.mentioned_accounts.where.not(domain: nil).pluck(:inbox_url).compact.uniq + ) + end + private def reached_account_inboxes diff --git a/app/workers/activitypub/distribution_worker.rb b/app/workers/activitypub/distribution_worker.rb index 34b6f6e32f..57ee1fbc0a 100644 --- a/app/workers/activitypub/distribution_worker.rb +++ b/app/workers/activitypub/distribution_worker.rb @@ -7,13 +7,23 @@ class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker @status = Status.find(status_id) @account = @status.account - distribute! + if @status.limited_visibility? + distribute_limited! + else + distribute! + end rescue ActiveRecord::RecordNotFound true end protected + def distribute_limited! + ActivityPub::DeliveryWorker.push_bulk(inboxes_for_limited, limit: 1_000) do |inbox_url| + [payload, @account.id, inbox_url, options] + end + end + def inboxes @inboxes ||= status_reach_finder.inboxes end @@ -22,6 +32,10 @@ class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker @inboxes_for_misskey ||= status_reach_finder.inboxes_for_misskey end + def inboxes_for_limited + @inboxes_for_limited ||= status_reach_finder.inboxes_for_limited + end + def status_reach_finder @status_reach_finder ||= StatusReachFinder.new(@status) end diff --git a/spec/workers/activitypub/distribution_worker_spec.rb b/spec/workers/activitypub/distribution_worker_spec.rb index d8803f6b8a..df078dbf69 100644 --- a/spec/workers/activitypub/distribution_worker_spec.rb +++ b/spec/workers/activitypub/distribution_worker_spec.rb @@ -6,7 +6,7 @@ describe ActivityPub::DistributionWorker do subject { described_class.new } let(:status) { Fabricate(:status) } - let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com', domain: 'example.com') } + let(:follower) { Fabricate(:account, protocol: :activitypub, shared_inbox_url: 'http://example.com', inbox_url: 'http://example.com/follower/inbox', domain: 'example.com') } describe '#perform' do before do @@ -24,6 +24,18 @@ describe ActivityPub::DistributionWorker do end end + context 'with unlisted status' do + before do + status.update(visibility: :unlisted) + end + + it 'delivers to followers' do + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do + subject.perform(status.id) + end + end + end + context 'with private status' do before do status.update(visibility: :private) @@ -35,6 +47,20 @@ describe ActivityPub::DistributionWorker do end end + context 'with limited status' do + before do + status.update(visibility: :limited) + status.capability_tokens.create! + status.mentions.create!(account: follower, silent: true) + end + + it 'delivers to followers' do + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com/follower/inbox', anything]]) do + subject.perform(status.id) + end + end + end + context 'with direct status' do let(:mentioned_account) { Fabricate(:account, protocol: :activitypub, inbox_url: 'https://foo.bar/inbox', domain: 'foo.bar') } From b22513ca07e67abcdcaa1571425ea457025d18d6 Mon Sep 17 00:00:00 2001 From: KMY Date: Tue, 28 Nov 2023 12:35:54 +0900 Subject: [PATCH 6/6] Fix test --- spec/workers/activitypub/distribution_worker_spec.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spec/workers/activitypub/distribution_worker_spec.rb b/spec/workers/activitypub/distribution_worker_spec.rb index df078dbf69..aaf4dbfcce 100644 --- a/spec/workers/activitypub/distribution_worker_spec.rb +++ b/spec/workers/activitypub/distribution_worker_spec.rb @@ -30,9 +30,8 @@ describe ActivityPub::DistributionWorker do end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do - subject.perform(status.id) - end + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) + subject.perform(status.id) end end @@ -55,9 +54,8 @@ describe ActivityPub::DistributionWorker do end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com/follower/inbox', anything]]) do - subject.perform(status.id) - end + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com/follower/inbox', anything]]) + subject.perform(status.id) end end