mirror of
https://github.com/discourse/discourse.git
synced 2025-02-12 03:21:01 +08:00
FIX: ensure consistency should handle cases where a topic trashed
Followup to c05b6170
This commit is contained in:
parent
ee142c2173
commit
ff3a1eae3a
|
@ -679,7 +679,7 @@ class Category < ActiveRecord::Base
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
DB.query_single(sql).each do |id|
|
DB.query_single(sql).each do |id|
|
||||||
Topic.find(id).destroy!
|
Topic.with_deleted.find_by(id: id).destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
sql = <<~SQL
|
sql = <<~SQL
|
||||||
|
|
|
@ -898,6 +898,9 @@ describe Category do
|
||||||
uncategorized.create_category_definition
|
uncategorized.create_category_definition
|
||||||
uncategorized.topic.posts.first.destroy!
|
uncategorized.topic.posts.first.destroy!
|
||||||
|
|
||||||
|
# make stuff extra broken
|
||||||
|
uncategorized.topic.trash!
|
||||||
|
|
||||||
category = Fabricate(:category)
|
category = Fabricate(:category)
|
||||||
category_destroyed = Fabricate(:category)
|
category_destroyed = Fabricate(:category)
|
||||||
category_trashed = Fabricate(:category)
|
category_trashed = Fabricate(:category)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user