mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 22:03:45 +08:00
Pass data to description to prevent duplication
This commit is contained in:
parent
8c349101c5
commit
70e27641eb
|
@ -10,7 +10,7 @@ createWidgetFrom(DefaultNotificationItem, "custom-notification-item", {
|
|||
|
||||
text(notificationName, data) {
|
||||
const username = formatUsername(data.display_username);
|
||||
const description = this.description();
|
||||
const description = this.description(data);
|
||||
|
||||
return I18n.t(data.message, { description, username });
|
||||
},
|
||||
|
|
|
@ -58,8 +58,7 @@ export const DefaultNotificationItem =
|
|||
}
|
||||
},
|
||||
|
||||
description() {
|
||||
const data = this.attrs.data;
|
||||
description(data) {
|
||||
const badgeName = data.badge_name;
|
||||
if (badgeName) {
|
||||
return escapeExpression(badgeName);
|
||||
|
@ -81,7 +80,7 @@ export const DefaultNotificationItem =
|
|||
|
||||
text(notificationName, data) {
|
||||
const username = formatUsername(data.display_username);
|
||||
const description = this.description();
|
||||
const description = this.description(data);
|
||||
|
||||
return I18n.t(`notifications.${notificationName}`, { description, username });
|
||||
},
|
||||
|
|
|
@ -14,9 +14,7 @@ createWidgetFrom(DefaultNotificationItem, "liked-consolidated-notification-item"
|
|||
);
|
||||
},
|
||||
|
||||
description() {
|
||||
const data = this.attrs.data;
|
||||
|
||||
description(data) {
|
||||
const description =
|
||||
I18n.t("notifications.liked_consolidated_description", {
|
||||
count: parseInt(data.count)
|
||||
|
|
|
@ -5,7 +5,7 @@ import { formatUsername } from "discourse/lib/utilities";
|
|||
createWidgetFrom(DefaultNotificationItem, "liked-notification-item", {
|
||||
text(notificationName, data) {
|
||||
const username = formatUsername(data.display_username);
|
||||
const description = this.description();
|
||||
const description = this.description(data);
|
||||
|
||||
if (data.count > 1) {
|
||||
const count = data.count - 2;
|
||||
|
|
Loading…
Reference in New Issue
Block a user