UX: show only one username on multiple likes notification (#23385)

To adjust for small width screen and multiple locales only show one
username on multiple likes notification.
This commit is contained in:
Meghna 2023-09-06 15:30:56 +05:30 committed by GitHub
parent ede73f923f
commit 48951bb35e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 10 deletions

View File

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

View File

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

View File

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

View File

@ -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"