FIX: staff should be allowed to agree and keep post
This commit is contained in:
parent
8477501e83
commit
6797395bd0
|
@ -83,10 +83,12 @@ class Admin::FlagsController < Admin::AdminController
|
||||||
elsif restore_post
|
elsif restore_post
|
||||||
PostAction.agree_flags!(post, current_user, delete_post)
|
PostAction.agree_flags!(post, current_user, delete_post)
|
||||||
PostDestroyer.new(current_user, post).recover
|
PostDestroyer.new(current_user, post).recover
|
||||||
elsif !keep_post
|
else
|
||||||
PostAction.agree_flags!(post, current_user, delete_post)
|
PostAction.agree_flags!(post, current_user, delete_post)
|
||||||
|
if !keep_post
|
||||||
PostAction.hide_post!(post, post_action_type)
|
PostAction.hide_post!(post, post_action_type)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
render body: nil
|
render body: nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,22 @@ RSpec.describe Admin::FlagsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context '#agree' do
|
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.allow_user_locale = true
|
||||||
SiteSetting.queue_jobs = false
|
SiteSetting.queue_jobs = false
|
||||||
|
|
||||||
|
@ -42,7 +57,6 @@ RSpec.describe Admin::FlagsController do
|
||||||
admin.update!(locale: 'ja')
|
admin.update!(locale: 'ja')
|
||||||
|
|
||||||
post "/admin/flags/agree/#{post_1.id}.json"
|
post "/admin/flags/agree/#{post_1.id}.json"
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
post_action.reload
|
post_action.reload
|
||||||
|
|
Loading…
Reference in New Issue