A platform for community discussion. Free, open, simple.
UX: show only one username on multiple likes notification (#23385)
Meghna48951bb35e81
diff --git a/app/assets/javascripts/discourse/app/lib/notification-types/liked.js b/app/assets/javascripts/discourse/app/lib/notification-types/liked.jsindex 0129ed5130a..e7c60e3ab25 100644--- a/app/assets/javascripts/discourse/app/lib/notification-types/liked.js+++ b/app/assets/javascripts/discourse/app/lib/notification-types/liked.js@@ -12,8 +12,7 @@ export default class extends NotificationTypeBase {} else if (this.count > 2) {return I18n.t("notifications.liked_by_multiple_users", {username: this.username,- username2: this.#username2,- count: this.count - 2,+ count: this.count - 1,});} else {return super.label;diff --git a/app/assets/javascripts/discourse/app/widgets/liked-notification-item.js b/app/assets/javascripts/discourse/app/widgets/liked-notification-item.jsindex 97b62d4eba0..57327fb6380 100644--- a/app/assets/javascripts/discourse/app/widgets/liked-notification-item.js+++ b/app/assets/javascripts/discourse/app/widgets/liked-notification-item.js@@ -9,7 +9,7 @@ createWidgetFrom(DefaultNotificationItem, "liked-notification-item", {const description = this.description(data);if (data.count > 1) {- const count = data.count - 2;+ const count = data.count - 1;const username2 = formatUsername(data.username2);if (count === 0) {@@ -22,7 +22,6 @@ createWidgetFrom(DefaultNotificationItem, "liked-notification-item", {return I18n.t("notifications.liked_many", {description,username: `<span class="multi-username">${username}</span>`,- username2: `<span class="multi-username">${username2}</span>`,count,});}diff --git a/app/assets/javascripts/discourse/tests/unit/lib/notification-types/liked-test.js b/app/assets/javascripts/discourse/tests/unit/lib/notification-types/liked-test.jsindex 441e147ac4b..43af7e81b31 100644--- a/app/assets/javascripts/discourse/tests/unit/lib/notification-types/liked-test.js+++ b/app/assets/javascripts/discourse/tests/unit/lib/notification-types/liked-test.js@@ -58,8 +58,7 @@ module("Unit | Notification Types | liked", function (hooks) {director.label,I18n.t("notifications.liked_by_multiple_users", {username: "osama",- username2: "shrek",- count: 1,+ count: 2,}),"concatenates 2 usernames with comma and displays the remaining count when count larger than 2");diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex cbd1d6291b8..3d1a69d1b76 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -2543,12 +2543,12 @@ en:liked: "<span>%{username}</span> %{description}"liked_2: "<span class='double-user'>%{username}, %{username2}</span> %{description}"liked_many:- one: "<span class='multi-user'>%{username}, %{username2} and %{count} other</span> %{description}"- other: "<span class='multi-user'>%{username}, %{username2} and %{count} others</span> %{description}"+ one: "<span class='multi-user'>%{username} and %{count} other</span> %{description}"+ other: "<span class='multi-user'>%{username} and %{count} others</span> %{description}"liked_by_2_users: "%{username}, %{username2}"liked_by_multiple_users:- one: "%{username}, %{username2} and %{count} other"- other: "%{username}, %{username2} and %{count} others"+ one: "%{username} and %{count} other"+ other: "%{username} and %{count} others"liked_consolidated_description:one: "liked %{count} of your posts"other: "liked %{count} of your posts"