mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-26 15:31:52 +00:00
block scheduled status from frozen users (#30729)
This commit is contained in:
parent
683db3ab25
commit
2526b32ad3
|
@ -9,6 +9,8 @@ class PublishScheduledStatusWorker
|
||||||
scheduled_status = ScheduledStatus.find(scheduled_status_id)
|
scheduled_status = ScheduledStatus.find(scheduled_status_id)
|
||||||
scheduled_status.destroy!
|
scheduled_status.destroy!
|
||||||
|
|
||||||
|
return true if scheduled_status.account.user.disabled?
|
||||||
|
|
||||||
PostStatusService.new.call(
|
PostStatusService.new.call(
|
||||||
scheduled_status.account,
|
scheduled_status.account,
|
||||||
options_with_objects(scheduled_status.params.with_indifferent_access)
|
options_with_objects(scheduled_status.params.with_indifferent_access)
|
||||||
|
|
|
@ -12,12 +12,26 @@ RSpec.describe PublishScheduledStatusWorker do
|
||||||
subject.perform(scheduled_status.id)
|
subject.perform(scheduled_status.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates a status' do
|
context 'when the account is not disabled' do
|
||||||
expect(scheduled_status.account.statuses.first.text).to eq 'Hello world, future!'
|
it 'creates a status' do
|
||||||
|
expect(scheduled_status.account.statuses.first.text).to eq 'Hello world, future!'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'removes the scheduled status' do
|
||||||
|
expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'removes the scheduled status' do
|
context 'when the account is disabled' do
|
||||||
expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user