1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
This commit is contained in:
Paulo Vilarinho 2024-07-31 11:06:49 +00:00 committed by GitHub
commit 1e67ead600
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View file

@ -9,6 +9,8 @@ class PublishScheduledStatusWorker
scheduled_status = ScheduledStatus.find(scheduled_status_id)
scheduled_status.destroy!
return true if scheduled_status.account.user.disabled?
PostStatusService.new.call(
scheduled_status.account,
options_with_objects(scheduled_status.params.with_indifferent_access)

View file

@ -12,6 +12,7 @@ describe PublishScheduledStatusWorker do
subject.perform(scheduled_status.id)
end
context 'when the account is not disabled' do
it 'creates a status' do
expect(scheduled_status.account.statuses.first.text).to eq 'Hello world, future!'
end
@ -20,4 +21,17 @@ describe PublishScheduledStatusWorker do
expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil
end
end
context 'when the account is disabled' do
let(:scheduled_status) { Fabricate(:scheduled_status, account: Fabricate(:account, user: Fabricate(:user, disabled: true))) }
it 'does not create a status' do
expect(Status.count).to eq 0
end
it 'removes the scheduled status' do
expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil
end
end
end
end