FIX: staff should be allowed to agree and keep post
This commit is contained in:
parent
8477501e83
commit
6797395bd0
|
@ -83,9 +83,11 @@ class Admin::FlagsController < Admin::AdminController
|
|||
elsif restore_post
|
||||
PostAction.agree_flags!(post, current_user, delete_post)
|
||||
PostDestroyer.new(current_user, post).recover
|
||||
elsif !keep_post
|
||||
else
|
||||
PostAction.agree_flags!(post, current_user, delete_post)
|
||||
PostAction.hide_post!(post, post_action_type)
|
||||
if !keep_post
|
||||
PostAction.hide_post!(post, post_action_type)
|
||||
end
|
||||
end
|
||||
|
||||
render body: nil
|
||||
|
|
|
@ -34,7 +34,22 @@ RSpec.describe Admin::FlagsController do
|
|||
end
|
||||
|
||||
context '#agree' do
|
||||
it 'should work' do
|
||||
it 'should be able to agree and keep content' do
|
||||
SiteSetting.queue_jobs = false
|
||||
|
||||
post_action = PostAction.act(user, post_1, PostActionType.types[:spam], message: 'bad')
|
||||
|
||||
post "/admin/flags/agree/#{post_1.id}.json", params: { action_on_post: 'keep' }
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
post_action.reload
|
||||
expect(post_action.agreed_by_id).to eq(admin.id)
|
||||
|
||||
post_1.reload
|
||||
expect(post_1.deleted_at).to eq(nil)
|
||||
end
|
||||
|
||||
it 'should be able to hide spam' do
|
||||
SiteSetting.allow_user_locale = true
|
||||
SiteSetting.queue_jobs = false
|
||||
|
||||
|
@ -42,7 +57,6 @@ RSpec.describe Admin::FlagsController do
|
|||
admin.update!(locale: 'ja')
|
||||
|
||||
post "/admin/flags/agree/#{post_1.id}.json"
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
post_action.reload
|
||||
|
|
Loading…
Reference in New Issue