mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: There was an error renaming the Uncategorized topic
This commit is contained in:
parent
625d74dd10
commit
6ba5f715f3
2 changed files with 5 additions and 0 deletions
|
@ -337,6 +337,7 @@ SQL
|
|||
# an exact match
|
||||
def rename_category_definition
|
||||
old_name = changed_attributes["name"]
|
||||
return unless topic.present?
|
||||
if topic.title == I18n.t("category.topic_prefix", category: old_name)
|
||||
topic.update_column(:title, I18n.t("category.topic_prefix", category: name))
|
||||
end
|
||||
|
|
|
@ -226,6 +226,10 @@ describe Category do
|
|||
@topic.title.should =~ /Troutfishing/
|
||||
end
|
||||
|
||||
it "doesn't raise an error if there is no definition topic to rename (uncategorized)" do
|
||||
-> { @category.update_attributes(name: 'Troutfishing', topic_id: nil) }.should_not raise_error
|
||||
end
|
||||
|
||||
it "should not set its description topic to auto-close" do
|
||||
category = Fabricate(:category, name: 'Closing Topics', auto_close_hours: 1)
|
||||
category.topic.auto_close_at.should be_nil
|
||||
|
|
Loading…
Reference in a new issue