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:
parent
b2575a8ce3
commit
ab68379abb
|
@ -135,7 +135,9 @@ class TopicsBulkAction
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
topics.each do |t|
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ describe TopicsBulkAction do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "delete" do
|
describe "delete" do
|
||||||
let(:topic) { Fabricate(:topic) }
|
let(:topic) { Fabricate(:post).topic }
|
||||||
let(:moderator) { Fabricate(:moderator) }
|
let(:moderator) { Fabricate(:moderator) }
|
||||||
|
|
||||||
it "deletes the topic" do
|
it "deletes the topic" do
|
||||||
|
|
Loading…
Reference in New Issue