FIX: Missing sidebar section link icon for PM tags (#18481)

No tests cause a missing icon regression is not the end of the world and
I don't feel like it will provide enough value as a regression test long
term.
This commit is contained in:
Alan Guo Xiang Tan 2022-10-05 14:20:03 +08:00 committed by GitHub
parent 637b1211b5
commit c0037dc0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 36 deletions

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}