Merge pull request #1744 from verg/prevent_delete_uncategorized

Prevent deleting 'uncategorized' category
This commit is contained in:
Sam
2014-01-01 16:09:49 -08:00
5 changed files with 16 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
}.property('saving', 'name', 'color', 'deleting'),
deleteVisible: function() {
return (this.get('id') && this.get('topic_count') === 0);
return (this.get('id') && this.get('topic_count') === 0 && !this.get("isUncategorizedCategory"));
}.property('id', 'topic_count'),
deleteDisabled: function() {

View File

@@ -168,8 +168,11 @@ Discourse.Category = Discourse.Model.extend({
if (stats.length === 2) return false;
}, this);
return stats;
}
},
isUncategorizedCategory: function() {
return this.get('id') === Discourse.Site.currentProp("uncategorized_category_id");
}.property('id')
});
Discourse.Category.reopenClass({