mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
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),
|
getOwner(this),
|
||||||
tab.panelComponent
|
tab.panelComponent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.appEvents.trigger("user-menu:tab-click", tab.id);
|
||||||
this.currentNotificationTypes = tab.notificationTypes;
|
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";
|
import UserMenuReviewableItem from "discourse/lib/user-menu/reviewable-item";
|
||||||
|
|
||||||
export default class UserMenuNotificationsList extends UserMenuItemsList {
|
export default class UserMenuNotificationsList extends UserMenuItemsList {
|
||||||
|
@service appEvents;
|
||||||
@service currentUser;
|
@service currentUser;
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
@service site;
|
@service site;
|
||||||
@ -108,6 +109,7 @@ export default class UserMenuNotificationsList extends UserMenuItemsList {
|
|||||||
}
|
}
|
||||||
).forEach((item) => {
|
).forEach((item) => {
|
||||||
const props = {
|
const props = {
|
||||||
|
appEvents: this.appEvents,
|
||||||
currentUser: this.currentUser,
|
currentUser: this.currentUser,
|
||||||
siteSettings: this.siteSettings,
|
siteSettings: this.siteSettings,
|
||||||
site: this.site,
|
site: this.site,
|
||||||
@ -126,6 +128,7 @@ export default class UserMenuNotificationsList extends UserMenuItemsList {
|
|||||||
content.push(
|
content.push(
|
||||||
new UserMenuNotificationItem({
|
new UserMenuNotificationItem({
|
||||||
notification,
|
notification,
|
||||||
|
appEvents: this.appEvents,
|
||||||
currentUser: this.currentUser,
|
currentUser: this.currentUser,
|
||||||
siteSettings: this.siteSettings,
|
siteSettings: this.siteSettings,
|
||||||
site: this.site,
|
site: this.site,
|
||||||
|
@ -5,8 +5,9 @@ import { setTransientHeader } from "discourse/lib/ajax";
|
|||||||
import { getRenderDirector } from "discourse/lib/notification-types-manager";
|
import { getRenderDirector } from "discourse/lib/notification-types-manager";
|
||||||
|
|
||||||
export default class UserMenuNotificationItem extends UserMenuBaseItem {
|
export default class UserMenuNotificationItem extends UserMenuBaseItem {
|
||||||
constructor({ notification, currentUser, siteSettings, site }) {
|
constructor({ notification, appEvents, currentUser, siteSettings, site }) {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
|
this.appEvents = appEvents;
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
this.currentUser = currentUser;
|
this.currentUser = currentUser;
|
||||||
this.siteSettings = siteSettings;
|
this.siteSettings = siteSettings;
|
||||||
@ -62,6 +63,8 @@ export default class UserMenuNotificationItem extends UserMenuBaseItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClick() {
|
onClick() {
|
||||||
|
this.appEvents.trigger("user-menu:notification-click", this.notification);
|
||||||
|
|
||||||
if (!this.notification.read) {
|
if (!this.notification.read) {
|
||||||
this.notification.set("read", true);
|
this.notification.set("read", true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user