mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #1744 from verg/prevent_delete_uncategorized
Prevent deleting 'uncategorized' category
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user