mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 23:02:45 +08:00
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
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user