mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:16:41 +08:00
Pull group message summary behaviour into its own class
This commit is contained in:
parent
396e13aaa7
commit
36d7abed0b
|
@ -112,14 +112,6 @@ export const DefaultNotificationItem =
|
|||
const scope =
|
||||
notificationName === "custom" ? data.message : `notifications.${notificationName}`;
|
||||
|
||||
const notificationTypes = this.site.notification_types;
|
||||
|
||||
if (notificationType === notificationTypes.group_message_summary) {
|
||||
const count = data.inbox_count;
|
||||
const group_name = data.group_name;
|
||||
return I18n.t(scope, { count, group_name });
|
||||
}
|
||||
|
||||
const username = formatUsername(data.display_username);
|
||||
const description = this.description();
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { createWidgetFrom } from "discourse/widgets/widget";
|
||||
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
|
||||
|
||||
createWidgetFrom(DefaultNotificationItem, "group-message-summary-notification-item", {
|
||||
text(notificationType, notificationName) {
|
||||
const { attrs } = this;
|
||||
const data = attrs.data;
|
||||
const count = data.inbox_count;
|
||||
const group_name = data.group_name;
|
||||
|
||||
return I18n.t("notifications.group_message_summary", { count, group_name });
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user