From 8049dfdfda8c6d8f58a645edbb67b0a90b313736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 12 Jan 2016 11:29:26 +0100 Subject: [PATCH] CLEANUP: remove 'contains_messages' leftover :poop: --- .../discourse/components/category-chooser.js.es6 | 1 - .../javascripts/discourse/controllers/topic.js.es6 | 7 +------ .../javascripts/discourse/models/category.js.es6 | 1 - .../javascripts/discourse/models/composer.js.es6 | 8 +++----- .../templates/components/edit-category-settings.hbs | 6 ------ app/controllers/categories_controller.rb | 1 - app/models/category.rb | 1 - app/models/topic.rb | 1 - app/serializers/basic_category_serializer.rb | 3 +-- config/locales/client.en.yml | 1 - ...0112101818_remove_contains_message_on_category.rb | 5 +++++ spec/controllers/topics_controller_spec.rb | 12 ------------ 12 files changed, 10 insertions(+), 37 deletions(-) create mode 100644 db/migrate/20160112101818_remove_contains_message_on_category.rb diff --git a/app/assets/javascripts/discourse/components/category-chooser.js.es6 b/app/assets/javascripts/discourse/components/category-chooser.js.es6 index 1611fcbe5d5..6e49537e887 100644 --- a/app/assets/javascripts/discourse/components/category-chooser.js.es6 +++ b/app/assets/javascripts/discourse/components/category-chooser.js.es6 @@ -22,7 +22,6 @@ export default ComboboxView.extend({ return categories.filter(c => { if (scopedCategoryId && c.get('id') !== scopedCategoryId && c.get('parent_category_id') !== scopedCategoryId) { return false; } if (c.get('isUncategorizedCategory')) { return false; } - if (c.get('contains_messages')) { return false; } return c.get('permission') === PermissionType.FULL; }); }, diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 9c84a6d5027..617ad97ee95 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -90,12 +90,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, { this.set('selectedReplies', []); }.on('init'), - @computed("model.isPrivateMessage", "model.category_id") - showCategoryChooser(isPrivateMessage, categoryId) { - const category = Discourse.Category.findById(categoryId); - const containsMessages = category && category.get("contains_messages"); - return !isPrivateMessage && !containsMessages; - }, + showCategoryChooser: Ember.computed.not("model.isPrivateMessage"), gotoInbox(name) { var url = '/users/' + this.get('currentUser.username_lower') + '/messages'; diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6 index e507419c0ef..d26f68f1dd2 100644 --- a/app/assets/javascripts/discourse/models/category.js.es6 +++ b/app/assets/javascripts/discourse/models/category.js.es6 @@ -87,7 +87,6 @@ const Category = RestModel.extend({ custom_fields: this.get('custom_fields'), topic_template: this.get('topic_template'), suppress_from_homepage: this.get('suppress_from_homepage'), - contains_messages: this.get("contains_messages"), }, type: this.get('id') ? 'PUT' : 'POST' }); diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6 index f0bc7eaca1f..98488a6a4c4 100644 --- a/app/assets/javascripts/discourse/models/composer.js.es6 +++ b/app/assets/javascripts/discourse/models/composer.js.es6 @@ -67,12 +67,10 @@ const Composer = RestModel.extend({ creatingPrivateMessage: Em.computed.equal('action', PRIVATE_MESSAGE), notCreatingPrivateMessage: Em.computed.not('creatingPrivateMessage'), - @computed("privateMessage", "archetype.hasOptions", "categoryId") - showCategoryChooser(isPrivateMessage, hasOptions, categoryId) { + @computed("privateMessage", "archetype.hasOptions") + showCategoryChooser(isPrivateMessage, hasOptions) { const manyCategories = Discourse.Category.list().length > 1; - const category = Discourse.Category.findById(categoryId); - const containsMessages = category && category.get("contains_messages"); - return !isPrivateMessage && !containsMessages && (hasOptions || manyCategories); + return !isPrivateMessage && (hasOptions || manyCategories); }, privateMessage: function(){ diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs index 1a7fa9b421a..722a9f5e1f8 100644 --- a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs @@ -20,12 +20,6 @@ {{#if emailInEnabled}} -
- -