Use `PostDestroyer` to delete topics when performing bulk operation (#5202)

* Use `PostDestroyer` to delete topics when performing bulk operation

This PR should fix this bug: https://meta.discourse.org/t/bulk-deletion-of-topics-not-logged/50407?u=osama

* failing test
This commit is contained in:
OsamaSayegh 2017-09-28 15:22:49 +03:00 committed by Régis Hanol
parent b2575a8ce3
commit ab68379abb
2 changed files with 4 additions and 2 deletions

View File

@ -135,7 +135,9 @@ class TopicsBulkAction
def delete
topics.each do |t|
t.trash! if guardian.can_delete?(t)
if guardian.can_delete?(t)
PostDestroyer.new(@user, t.ordered_posts.first).destroy
end
end
end

View File

@ -66,7 +66,7 @@ describe TopicsBulkAction do
end
describe "delete" do
let(:topic) { Fabricate(:topic) }
let(:topic) { Fabricate(:post).topic }
let(:moderator) { Fabricate(:moderator) }
it "deletes the topic" do