mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Pull group message summary behaviour into its own class
This commit is contained in:
committed by
Robin Ward
parent
396e13aaa7
commit
36d7abed0b
@@ -112,14 +112,6 @@ export const DefaultNotificationItem =
|
|||||||
const scope =
|
const scope =
|
||||||
notificationName === "custom" ? data.message : `notifications.${notificationName}`;
|
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 username = formatUsername(data.display_username);
|
||||||
const description = this.description();
|
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 });
|
||||||
|
}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user