Dont distribute personal limited post

This commit is contained in:
KMY 2023-09-26 18:10:21 +09:00
parent 28ab1ca973
commit af62d7f96a
2 changed files with 15 additions and 2 deletions

View file

@ -196,9 +196,9 @@ class PostStatusService < BaseService
ProcessReferencesService.call_service(@status, @reference_ids, [])
LinkCrawlWorker.perform_async(@status.id)
DistributionWorker.perform_async(@status.id)
ActivityPub::DistributionWorker.perform_async(@status.id)
ActivityPub::DistributionWorker.perform_async(@status.id) unless @status.personal_limited?
PollExpirationNotifyWorker.perform_at(@status.poll.expires_at, @status.poll.id) if @status.poll
GroupReblogService.new.call(@status)
GroupReblogService.new.call(@status) unless @status.personal_limited?
end
def validate_status!

View file

@ -293,6 +293,19 @@ RSpec.describe PostStatusService, type: :service do
expect(ActivityPub::DistributionWorker).to have_received(:perform_async).with(status.id)
end
it 'gets distributed when personal post' do
allow(DistributionWorker).to receive(:perform_async)
allow(ActivityPub::DistributionWorker).to receive(:perform_async)
account = Fabricate(:account)
empty_circle = Fabricate(:circle, account: account)
status = subject.call(account, text: 'test status update', visibility: 'circle', circle_id: empty_circle.id)
expect(DistributionWorker).to have_received(:perform_async).with(status.id)
expect(ActivityPub::DistributionWorker).to_not have_received(:perform_async).with(status.id)
end
it 'crawls links' do
allow(LinkCrawlWorker).to receive(:perform_async)
account = Fabricate(:account)