FIX: :reject_user_delete action can only be handled by ReviewableUser (#8068)

This commit is contained in:
Roman Rizzi 2019-09-04 14:12:48 -03:00 committed by GitHub
parent c20d26a500
commit 7a70fce584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -116,7 +116,7 @@ class UserDestroyer
end
# After the user is deleted, remove the reviewable
if reviewable = Reviewable.pending.find_by(target: user)
if reviewable = ReviewableUser.pending.find_by(target: user)
reviewable.perform(@actor, :reject_user_delete)
end

View File

@ -100,6 +100,16 @@ describe UserDestroyer do
end
end
context "with a reviewable user" do
let(:reviewable) { Fabricate(:reviewable, created_by: admin) }
it 'sets the reviewable user as rejected' do
UserDestroyer.new(admin).destroy(reviewable.target)
expect(reviewable.reload.status).to eq(Reviewable.statuses[:rejected])
end
end
context "with a directory item record" do
it "removes the directory item" do