DEV: Use component references for user menu (#456)

See 9b41700f87 for context.

Passing a reference works before and after that change, so there is no need to introduce a discourse-compatibility entry.
This commit is contained in:
David Taylor 2023-03-24 17:55:23 +00:00 committed by GitHub
parent 7562925e0d
commit 996c5ea493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 19 deletions

View File

@ -1,3 +0,0 @@
import templateOnly from "@ember/component/template-only";
// TODO: colocate this component's template
export default templateOnly();

View File

@ -6,6 +6,7 @@ import Notification from "discourse/models/notification";
import I18n from "I18n"; import I18n from "I18n";
import showModal from "discourse/lib/show-modal"; import showModal from "discourse/lib/show-modal";
import Topic from "discourse/models/topic"; import Topic from "discourse/models/topic";
import UserMenuAssignsListEmptyState from "./assigns-list-empty-state";
export default class UserMenuAssignNotificationsList extends UserMenuNotificationsList { export default class UserMenuAssignNotificationsList extends UserMenuNotificationsList {
get dismissTypes() { get dismissTypes() {
@ -33,7 +34,7 @@ export default class UserMenuAssignNotificationsList extends UserMenuNotificatio
} }
get emptyStateComponent() { get emptyStateComponent() {
return "user-menu/assigns-list-empty-state"; return UserMenuAssignsListEmptyState;
} }
async fetchItems() { async fetchItems() {

View File

@ -1,4 +1,5 @@
import { withPluginApi } from "discourse/lib/plugin-api"; import { withPluginApi } from "discourse/lib/plugin-api";
import UserMenuAssignNotificationsList from "../components/user-menu/assigns-list";
export default { export default {
name: "assign-user-menu", name: "assign-user-menu",
@ -17,26 +18,15 @@ export default {
} }
api.registerUserMenuTab((UserMenuTab) => { api.registerUserMenuTab((UserMenuTab) => {
return class extends UserMenuTab { return class extends UserMenuTab {
get id() { id = "assign-list";
return "assign-list"; panelComponent = UserMenuAssignNotificationsList;
} icon = "user-plus";
notificationTypes = ["assigned"];
get panelComponent() {
return "user-menu/assigns-list";
}
get icon() {
return "user-plus";
}
get count() { get count() {
return this.getUnreadCountForType("assigned"); return this.getUnreadCountForType("assigned");
} }
get notificationTypes() {
return ["assigned"];
}
get linkWhenActive() { get linkWhenActive() {
return `${this.currentUser.path}/activity/assigned`; return `${this.currentUser.path}/activity/assigned`;
} }