mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 12:11:16 -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
|
# an exact match
|
||||||
def rename_category_definition
|
def rename_category_definition
|
||||||
old_name = changed_attributes["name"]
|
old_name = changed_attributes["name"]
|
||||||
|
return unless topic.present?
|
||||||
if topic.title == I18n.t("category.topic_prefix", category: old_name)
|
if topic.title == I18n.t("category.topic_prefix", category: old_name)
|
||||||
topic.update_column(:title, I18n.t("category.topic_prefix", category: name))
|
topic.update_column(:title, I18n.t("category.topic_prefix", category: name))
|
||||||
end
|
end
|
||||||
|
|
|
@ -226,6 +226,10 @@ describe Category do
|
||||||
@topic.title.should =~ /Troutfishing/
|
@topic.title.should =~ /Troutfishing/
|
||||||
end
|
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
|
it "should not set its description topic to auto-close" do
|
||||||
category = Fabricate(:category, name: 'Closing Topics', auto_close_hours: 1)
|
category = Fabricate(:category, name: 'Closing Topics', auto_close_hours: 1)
|
||||||
category.topic.auto_close_at.should be_nil
|
category.topic.auto_close_at.should be_nil
|
||||||
|
|
Loading…
Reference in a new issue