A platform for community discussion. Free, open, simple.
FIX: Missing sidebar section link icon for PM tags (#18481)
Alan Guo Xiang Tanc0037dc0f06f
diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/messages-section/message-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/messages-section/message-section-link.jsindex a28cebdeb7b..d1a10fefb0a 100644--- a/app/assets/javascripts/discourse/app/lib/sidebar/user/messages-section/message-section-link.js+++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/messages-section/message-section-link.js@@ -73,14 +73,10 @@ export default class MessageSectionLink {}get prefixType() {- if (this._isInbox) {- return "icon";- }+ return "icon";}get prefixValue() {- if (this._isInbox) {- return "inbox";- }+ return "inbox";}}diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/base-tag-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/base-tag-section-link.jsnew file mode 100644index 00000000000..6a32ae90277--- /dev/null+++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/base-tag-section-link.js@@ -0,0 +1,21 @@+export default class BaseTagSectionLink {+ constructor({ tagName }) {+ this.tagName = tagName;+ }++ get name() {+ return this.tagName;+ }++ get text() {+ return this.tagName;+ }++ get prefixType() {+ return "icon";+ }++ get prefixValue() {+ return "tag";+ }+}diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/pm-tag-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/pm-tag-section-link.jsindex fceac26abf6..3c1b4ccb1b6 100644--- a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/pm-tag-section-link.js+++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/pm-tag-section-link.js@@ -1,11 +1,9 @@-export default class PMTagSectionLink {- constructor({ tagName, currentUser }) {- this.tagName = tagName;- this.currentUser = currentUser;- }+import BaseTagSectionLink from "discourse/lib/sidebar/user/tags-section/base-tag-section-link";- get name() {- return this.tagName;+export default class PMTagSectionLink extends BaseTagSectionLink {+ constructor({ currentUser }) {+ super(...arguments);+ this.currentUser = currentUser;}get models() {@@ -15,8 +13,4 @@ export default class PMTagSectionLink {get route() {return "userPrivateMessages.tagsShow";}-- get text() {- return this.tagName;- }}diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.jsindex 85ee3ae9567..094fe74de26 100644--- a/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js+++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/tags-section/tag-section-link.js@@ -3,13 +3,14 @@ import I18n from "I18n";import { tracked } from "@glimmer/tracking";import { bind } from "discourse-common/utils/decorators";+import BaseTagSectionLink from "discourse/lib/sidebar/user/tags-section/base-tag-section-link";-export default class TagSectionLink {+export default class TagSectionLink extends BaseTagSectionLink {@tracked totalUnread = 0;@tracked totalNew = 0;- constructor({ tagName, topicTrackingState }) {- this.tagName = tagName;+ constructor({ topicTrackingState }) {+ super(...arguments);this.topicTrackingState = topicTrackingState;this.refreshCounts();}@@ -27,10 +28,6 @@ export default class TagSectionLink {}}- get name() {- return this.tagName;- }-get models() {return [this.tagName];}@@ -49,10 +46,6 @@ export default class TagSectionLink {return "tag.show tag.showNew tag.showUnread tag.showTop";}- get text() {- return this.tagName;- }-get badgeText() {if (this.totalUnread > 0) {return I18n.t("sidebar.unread_count", {@@ -64,12 +57,4 @@ export default class TagSectionLink {});}}-- get prefixType() {- return "icon";- }-- get prefixValue() {- return "tag";- }}