Pull group message summary behaviour into its own class

This commit is contained in:
Daniel Waterworth 2019-06-07 07:04:24 +01:00 committed by Robin Ward
parent 396e13aaa7
commit 36d7abed0b
2 changed files with 13 additions and 8 deletions

View File

@ -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();

View File

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