Skip to content

Commit

Permalink
Dont distribute personal limited post
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Sep 26, 2023
1 parent 28ab1ca commit af62d7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/post_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ def postprocess_status!
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!
Expand Down
13 changes: 13 additions & 0 deletions spec/services/post_status_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,19 @@
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)
Expand Down

0 comments on commit af62d7f

Please sign in to comment.