DEV: Fire appEvents for user menu events (opening/clicking) (#21322)
This commit is contained in:
parent
4cca7de22d
commit
685e1de3ea
|
@ -277,6 +277,8 @@ export default class UserMenu extends Component {
|
|||
getOwner(this),
|
||||
tab.panelComponent
|
||||
);
|
||||
|
||||
this.appEvents.trigger("user-menu:tab-click", tab.id);
|
||||
this.currentNotificationTypes = tab.notificationTypes;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import UserMenuReviewable from "discourse/models/user-menu-reviewable";
|
|||
import UserMenuReviewableItem from "discourse/lib/user-menu/reviewable-item";
|
||||
|
||||
export default class UserMenuNotificationsList extends UserMenuItemsList {
|
||||
@service appEvents;
|
||||
@service currentUser;
|
||||
@service siteSettings;
|
||||
@service site;
|
||||
|
@ -108,6 +109,7 @@ export default class UserMenuNotificationsList extends UserMenuItemsList {
|
|||
}
|
||||
).forEach((item) => {
|
||||
const props = {
|
||||
appEvents: this.appEvents,
|
||||
currentUser: this.currentUser,
|
||||
siteSettings: this.siteSettings,
|
||||
site: this.site,
|
||||
|
@ -126,6 +128,7 @@ export default class UserMenuNotificationsList extends UserMenuItemsList {
|
|||
content.push(
|
||||
new UserMenuNotificationItem({
|
||||
notification,
|
||||
appEvents: this.appEvents,
|
||||
currentUser: this.currentUser,
|
||||
siteSettings: this.siteSettings,
|
||||
site: this.site,
|
||||
|
|
|
@ -5,8 +5,9 @@ import { setTransientHeader } from "discourse/lib/ajax";
|
|||
import { getRenderDirector } from "discourse/lib/notification-types-manager";
|
||||
|
||||
export default class UserMenuNotificationItem extends UserMenuBaseItem {
|
||||
constructor({ notification, currentUser, siteSettings, site }) {
|
||||
constructor({ notification, appEvents, currentUser, siteSettings, site }) {
|
||||
super(...arguments);
|
||||
this.appEvents = appEvents;
|
||||
this.notification = notification;
|
||||
this.currentUser = currentUser;
|
||||
this.siteSettings = siteSettings;
|
||||
|
@ -62,6 +63,8 @@ export default class UserMenuNotificationItem extends UserMenuBaseItem {
|
|||
}
|
||||
|
||||
onClick() {
|
||||
this.appEvents.trigger("user-menu:notification-click", this.notification);
|
||||
|
||||
if (!this.notification.read) {
|
||||
this.notification.set("read", true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue