A platform for community discussion. Free, open, simple.
FIX: Do not show bookmark button label in PM topic footer (#26858)
Martin Brennanb1a78d9080df
diff --git a/app/assets/javascripts/discourse/app/components/topic-footer-buttons.hbs b/app/assets/javascripts/discourse/app/components/topic-footer-buttons.hbsindex 007f58cb0f4..5256f012f86 100644--- a/app/assets/javascripts/discourse/app/components/topic-footer-buttons.hbs+++ b/app/assets/javascripts/discourse/app/components/topic-footer-buttons.hbs@@ -29,7 +29,7 @@{{#if (eq actionable.type "inline-button")}}{{#if (eq actionable.id "bookmark")}}<BookmarkMenu- @showLabel={{true}}+ @showLabel={{this.showBookmarkLabel}}@bookmarkManager={{this.topicBookmarkManager}}@buttonClasses="btn-default"/>diff --git a/app/assets/javascripts/discourse/app/components/topic-footer-buttons.js b/app/assets/javascripts/discourse/app/components/topic-footer-buttons.jsindex baa10b136b0..43339bcda97 100644--- a/app/assets/javascripts/discourse/app/components/topic-footer-buttons.js+++ b/app/assets/javascripts/discourse/app/components/topic-footer-buttons.js@@ -74,4 +74,7 @@ export default Component.extend({@discourseComputed("topic.message_archived")archiveLabel: (archived) =>archived ? "topic.move_to_inbox.title" : "topic.archive_message.title",++ @discourseComputed("topic.isPrivateMessage")+ showBookmarkLabel: (isPM) => !isPM,});diff --git a/app/assets/javascripts/discourse/app/instance-initializers/topic-footer-buttons.js b/app/assets/javascripts/discourse/app/instance-initializers/topic-footer-buttons.jsindex 110b0b1fa0e..aa46b1fead2 100644--- a/app/assets/javascripts/discourse/app/instance-initializers/topic-footer-buttons.js+++ b/app/assets/javascripts/discourse/app/instance-initializers/topic-footer-buttons.js@@ -1,10 +1,5 @@import ShareTopicModal from "discourse/components/modal/share-topic";import { registerTopicFooterButton } from "discourse/lib/register-topic-footer-button";-import {- NO_REMINDER_ICON,- WITH_REMINDER_ICON,-} from "discourse/models/bookmark";-import I18n from "discourse-i18n";const SHARE_PRIORITY = 1000;const BOOKMARK_PRIORITY = 900;@@ -73,53 +68,16 @@ export default {registerTopicFooterButton({dependentKeys: ["topic.bookmarked", "topic.bookmarksWereChanged"],id: "bookmark",- icon() {- if (this.topic.bookmarks.some((bookmark) => bookmark.reminder_at)) {- return WITH_REMINDER_ICON;- }- return NO_REMINDER_ICON;- },priority: BOOKMARK_PRIORITY,- classNames() {- return this.topic.bookmarked- ? ["bookmark", "bookmarked"]- : ["bookmark"];- },- label() {- if (!this.topic.isPrivateMessage || this.site.mobileView) {- if (this.topic.bookmarkCount === 0) {- return "bookmarked.title";- } else if (this.topic.bookmarkCount === 1) {- return "bookmarked.edit_bookmark";- } else {- return "bookmarked.clear_bookmarks";- }- }- },- translatedTitle() {- if (this.topic.bookmarkCount === 0) {- return I18n.t("bookmarked.help.bookmark");- } else if (this.topic.bookmarkCount === 1) {- const anyTopicBookmarks = this.topic.bookmarks.some(- (bookmark) => bookmark.bookmarkable_type === "Topic"- );+ action: "toggleBookmark",- if (anyTopicBookmarks) {- return I18n.t("bookmarked.help.edit_bookmark_for_topic");- } else {- return I18n.t("bookmarked.help.edit_bookmark");- }- } else if (- this.topic.bookmarks.some((bookmark) => bookmark.reminder_at)- ) {- return I18n.t("bookmarked.help.unbookmark_with_reminder");- } else {- return I18n.t("bookmarked.help.unbookmark");- }+ // NOTE: These are null because the BookmarkMenu component is used+ // for this button instead in the template.+ icon() {+ return null;},- action: "toggleBookmark",- dropdown() {- return this.site.mobileView;+ translatedTitle() {+ return null;},});