mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 08:27:17 +08:00
FIX: Remove action buttons if post has already been reviewed (#20126)
* FIX: Remove action buttons if post has already been reviewed * Change the approve to reject test to expect an error * Adds a controller spec to ensure you can't edit a non-pending review item * Remove unnessary conditional
This commit is contained in:
@ -394,14 +394,15 @@ RSpec.describe Reviewable, type: :model do
|
||||
it "triggers a notification on approve -> reject to update status" do
|
||||
reviewable = Fabricate(:reviewable_queued_post, status: Reviewable.statuses[:approved])
|
||||
|
||||
expect do reviewable.perform(moderator, :reject_post) end.to change {
|
||||
Jobs::NotifyReviewable.jobs.size
|
||||
}.by(1)
|
||||
expect { reviewable.perform(moderator, :reject_post) }.to raise_error(
|
||||
Reviewable::InvalidAction,
|
||||
)
|
||||
end
|
||||
|
||||
job = Jobs::NotifyReviewable.jobs.last
|
||||
it "triggers a notification on approve -> edit to update status" do
|
||||
reviewable = Fabricate(:reviewable_queued_post, status: Reviewable.statuses[:approved])
|
||||
|
||||
expect(job["args"].first["reviewable_id"]).to eq(reviewable.id)
|
||||
expect(job["args"].first["updated_reviewable_ids"]).to contain_exactly(reviewable.id)
|
||||
expect { reviewable.perform(moderator, :edit_post) }.to raise_error(Reviewable::InvalidAction)
|
||||
end
|
||||
|
||||
it "triggers a notification on reject -> approve to update status" do
|
||||
|
Reference in New Issue
Block a user