A platform for community discussion. Free, open, simple.
REVERT: Remove feature topic on profile button from topic view (#8573)
Mark VanLandinghamd37dc14c5768
diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6index 66bb4acebfb..7b523ee7680 100644--- a/app/assets/javascripts/discourse/controllers/topic.js.es6+++ b/app/assets/javascripts/discourse/controllers/topic.js.es6@@ -689,19 +689,6 @@ export default Controller.extend(bufferedProperty("model"), {}},- toggleFeaturedOnProfile() {- if (!this.currentUser) return;-- if (- this.currentUser.featured_topic &&- this.currentUser.featured_topic.id !== this.model.id- ) {- bootbox.confirm(I18n.t("topic.remove_from_profile.warning"), result => {- if (result) return this._performToggleFeaturedOnProfile();- });- } else return this._performToggleFeaturedOnProfile();- },-jumpToIndex(index) {this._jumpToIndex(index);},@@ -1093,10 +1080,6 @@ export default Controller.extend(bufferedProperty("model"), {}},- _performToggleFeaturedOnProfile() {- this.model.toggleFeaturedOnProfile(this.currentUser).catch(popupAjaxError);- },-_jumpToIndex(index) {const postStream = this.get("model.postStream");diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6index 86515edadcc..c392bc20ef6 100644--- a/app/assets/javascripts/discourse/models/topic.js.es6+++ b/app/assets/javascripts/discourse/models/topic.js.es6@@ -444,21 +444,6 @@ const Topic = RestModel.extend({});},- toggleFeaturedOnProfile(user) {- const removing = user.get("featured_topic.id") === this.id;- const path = removing ? "clear-featured-topic" : "feature-topic";- return ajax(`/u/${user.username}/${path}`, {- type: "PUT",- data: { topic_id: this.id }- })- .then(() => {- const featuredTopic = removing ? null : this;- user.set("featured_topic", featuredTopic);- return;- })- .catch(popupAjaxError);- },-createGroupInvite(group) {return ajax(`/t/${this.id}/invite-group`, {type: "POST",diff --git a/app/assets/javascripts/discourse/templates/topic.hbs b/app/assets/javascripts/discourse/templates/topic.hbsindex 075cd72048a..0a7671bf64e 100644--- a/app/assets/javascripts/discourse/templates/topic.hbs+++ b/app/assets/javascripts/discourse/templates/topic.hbs@@ -103,7 +103,6 @@toggleClosed=(action "toggleClosed")toggleArchived=(action "toggleArchived")toggleVisibility=(action "toggleVisibility")- toggleFeaturedOnProfile=(action "toggleFeaturedOnProfile")showTopicStatusUpdate=(route-action "showTopicStatusUpdate")showFeatureTopic=(route-action "showFeatureTopic")showChangeTimestamp=(route-action "showChangeTimestamp")@@ -304,7 +303,6 @@toggleClosed=(action "toggleClosed")toggleArchived=(action "toggleArchived")toggleVisibility=(action "toggleVisibility")- toggleFeaturedOnProfile=(action "toggleFeaturedOnProfile")showTopicStatusUpdate=(route-action "showTopicStatusUpdate")showFeatureTopic=(route-action "showFeatureTopic")showChangeTimestamp=(route-action "showChangeTimestamp")diff --git a/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6 b/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6index e59b4c2424c..6463bc33de4 100644--- a/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6+++ b/app/assets/javascripts/discourse/widgets/topic-admin-menu.js.es6@@ -109,27 +109,6 @@ export default createWidget("topic-admin-menu", {const featured = topic.get("pinned_at") || topic.get("isBanner");const visible = topic.get("visible");- if (- this.siteSettings.allow_featured_topic_on_user_profiles &&- this.currentUser &&- topic.user_id === this.currentUser.get("id") &&- !topic.isPrivateMessage &&- !topic.category.read_restricted- ) {- let topicFeaturedOnProfile =- topic.id === this.currentUser.get("featured_topic.id");-- this.addActionButton({- className: "topic-action-feature-on-profile",- buttonClass: topicFeaturedOnProfile ? "btn-primary" : "btn-default",- action: "toggleFeaturedOnProfile",- icon: "id-card",- fullLabel: topicFeaturedOnProfile- ? "topic.remove_from_profile.title"- : "topic.feature_on_profile.title"- });- }-// Admin actionsif (this.currentUser && this.currentUser.get("canManageTopic")) {this.addActionButton({diff --git a/test/javascripts/widgets/topic-admin-menu-test.js.es6 b/test/javascripts/widgets/topic-admin-menu-test.js.es6index a7cd2a89b4a..3ed54ddd215 100644--- a/test/javascripts/widgets/topic-admin-menu-test.js.es6+++ b/test/javascripts/widgets/topic-admin-menu-test.js.es6@@ -11,7 +11,6 @@ const createArgs = topic => {toggleMultiSelect: () => {},deleteTopic: () => {},recoverTopic: () => {},- toggleFeaturedOnProfile: () => {},toggleClosed: () => {},toggleArchived: () => {},toggleVisibility: () => {},@@ -44,29 +43,6 @@ widgetTest("topic-admin-menu-button is present for admin/moderators", {}});-widgetTest(- "topic-admin-menu-button shows for non-admin when the use can feature the topic",- {- template: '{{mount-widget widget="topic-admin-menu-button" args=args}}',-- beforeEach() {- this.currentUser.setProperties({- admin: false,- moderator: false,- id: 123- });- const topic = Topic.create({ user_id: this.currentUser.id });- topic.category = Category.create({ read_restricted: false });- this.siteSettings.allow_featured_topic_on_user_profiles = true;- this.set("args", createArgs(topic));- },-- test(assert) {- assert.ok(exists(".toggle-admin-menu"), "admin wrench is present");- }- }-);-widgetTest("topic-admin-menu-button hides for non-admin when there is no action",{@@ -85,7 +61,7 @@ widgetTest(},test(assert) {- assert.ok(!exists(".toggle-admin-menu"), "admin wrench is present");+ assert.ok(!exists(".toggle-admin-menu"), "admin wrench is not present");}});