From 3bb7ad4be182d72ae97ade85e58fa763735ab9fc Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Mon, 18 Nov 2019 12:28:35 +0530 Subject: [PATCH] FEATURE: remove support for 'suppress_from_latest' category setting. (#8308) --- .../discourse/models/category.js.es6 | 1 - .../models/topic-tracking-state.js.es6 | 14 ----- .../components/edit-category-settings.hbs | 7 --- app/controllers/categories_controller.rb | 7 +-- app/controllers/list_controller.rb | 20 +----- app/controllers/tags_controller.rb | 1 - app/models/category.rb | 6 +- app/models/category_featured_topic.rb | 13 +--- app/models/site.rb | 4 -- app/serializers/category_serializer.rb | 5 -- app/serializers/site_serializer.rb | 1 - config/locales/client.en.yml | 1 - ...move_suppress_from_latest_from_category.rb | 46 ++++++++++++++ lib/import_export/base_exporter.rb | 2 +- lib/topic_query.rb | 8 +-- script/import_scripts/discuz_x.rb | 5 +- spec/fixtures/json/import-export.json | 12 ++-- spec/models/category_featured_topic_spec.rb | 18 ------ spec/requests/categories_controller_spec.rb | 12 ---- spec/requests/list_controller_spec.rb | 63 +------------------ 20 files changed, 64 insertions(+), 182 deletions(-) create mode 100644 db/post_migrate/20191107190330_remove_suppress_from_latest_from_category.rb diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6 index 85cb273207a..2de39b44e48 100644 --- a/app/assets/javascripts/discourse/models/category.js.es6 +++ b/app/assets/javascripts/discourse/models/category.js.es6 @@ -132,7 +132,6 @@ const Category = RestModel.extend({ allow_badges: this.allow_badges, custom_fields: this.custom_fields, topic_template: this.topic_template, - suppress_from_latest: this.suppress_from_latest, all_topics_wiki: this.all_topics_wiki, allowed_tags: this.allowed_tags, allowed_tag_groups: this.allowed_tag_groups, diff --git a/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 b/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 index 9a565f379d0..33a6d4d9d64 100644 --- a/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-tracking-state.js.es6 @@ -5,11 +5,9 @@ import { default as discourseComputed, on } from "discourse-common/utils/decorators"; -import { defaultHomepage } from "discourse/lib/utilities"; import PreloadStore from "preload-store"; import Category from "discourse/models/category"; import EmberObject from "@ember/object"; -import Site from "discourse/models/site"; import User from "discourse/models/user"; function isNew(topic) { @@ -144,18 +142,6 @@ const TopicTrackingState = EmberObject.extend({ } } - if (filter === defaultHomepage()) { - const suppressed_from_latest_category_ids = Site.currentProp( - "suppressed_from_latest_category_ids" - ); - if ( - suppressed_from_latest_category_ids && - suppressed_from_latest_category_ids.includes(data.payload.category_id) - ) { - return; - } - } - if ( ["all", "latest", "new"].includes(filter) && data.message_type === "new_topic" 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 8c1f5472d33..1f65507a768 100644 --- a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs @@ -58,13 +58,6 @@ {{/if}} -
- -
-