mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 22:13: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) {
|
text(notificationName, data) {
|
||||||
const username = formatUsername(data.display_username);
|
const username = formatUsername(data.display_username);
|
||||||
const description = this.description();
|
const description = this.description(data);
|
||||||
|
|
||||||
return I18n.t(data.message, { description, username });
|
return I18n.t(data.message, { description, username });
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,8 +58,7 @@ export const DefaultNotificationItem =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
description() {
|
description(data) {
|
||||||
const data = this.attrs.data;
|
|
||||||
const badgeName = data.badge_name;
|
const badgeName = data.badge_name;
|
||||||
if (badgeName) {
|
if (badgeName) {
|
||||||
return escapeExpression(badgeName);
|
return escapeExpression(badgeName);
|
||||||
|
@ -81,7 +80,7 @@ export const DefaultNotificationItem =
|
||||||
|
|
||||||
text(notificationName, data) {
|
text(notificationName, data) {
|
||||||
const username = formatUsername(data.display_username);
|
const username = formatUsername(data.display_username);
|
||||||
const description = this.description();
|
const description = this.description(data);
|
||||||
|
|
||||||
return I18n.t(`notifications.${notificationName}`, { description, username });
|
return I18n.t(`notifications.${notificationName}`, { description, username });
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,9 +14,7 @@ createWidgetFrom(DefaultNotificationItem, "liked-consolidated-notification-item"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
description() {
|
description(data) {
|
||||||
const data = this.attrs.data;
|
|
||||||
|
|
||||||
const description =
|
const description =
|
||||||
I18n.t("notifications.liked_consolidated_description", {
|
I18n.t("notifications.liked_consolidated_description", {
|
||||||
count: parseInt(data.count)
|
count: parseInt(data.count)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { formatUsername } from "discourse/lib/utilities";
|
||||||
createWidgetFrom(DefaultNotificationItem, "liked-notification-item", {
|
createWidgetFrom(DefaultNotificationItem, "liked-notification-item", {
|
||||||
text(notificationName, data) {
|
text(notificationName, data) {
|
||||||
const username = formatUsername(data.display_username);
|
const username = formatUsername(data.display_username);
|
||||||
const description = this.description();
|
const description = this.description(data);
|
||||||
|
|
||||||
if (data.count > 1) {
|
if (data.count > 1) {
|
||||||
const count = data.count - 2;
|
const count = data.count - 2;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user