From 5b75d2c9fa4c4d7aaa37c94171ae7d041fee4413 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 5 Aug 2025 10:30:23 +0200 Subject: [PATCH] fix(l10n): Don't use "All 1 participant" Signed-off-by: Joas Schilling --- lib/Chat/ChatManager.php | 11 +++++++++-- tests/integration/features/chat-2/mentions.feature | 2 +- tests/php/Chat/ChatManagerTest.php | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index 7d6940a1648..5a7fb867256 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -1030,13 +1030,20 @@ public function addConversationNotify(array $results, string $search, Room $room } if ($search === '' || $this->searchIsPartOfConversationNameOrAtAll($search, $roomDisplayName)) { $participantCount = $this->participantService->getNumberOfUsers($room); - $results[] = [ + + $atAllResult = [ 'id' => 'all', 'label' => $roomDisplayName, - 'details' => $this->l->n('All %n participant', 'All %n participants', $participantCount), 'source' => 'calls', 'mentionId' => 'all', ]; + + if ($participantCount > 1) { + // TRANSLATORS The string will only be used with more than 1 participant, so you can keep the "All" in all plural forms + $atAllResult['details'] = $this->l->n('All %n participant', 'All %n participants', $participantCount); + } + + $results[] = $atAllResult; } return $results; } diff --git a/tests/integration/features/chat-2/mentions.feature b/tests/integration/features/chat-2/mentions.feature index 3c20f13a793..3524852cb68 100644 --- a/tests/integration/features/chat-2/mentions.feature +++ b/tests/integration/features/chat-2/mentions.feature @@ -61,7 +61,7 @@ Feature: chat/mentions | roomName | room | Then user "participant1" gets the following candidate mentions in room "group room" for "" with 200 | id | label | source | mentionId | details | - | all | room | calls | all | All 1 participant | + | all | room | calls | all | | Scenario: get mentions in a group room When user "participant1" creates room "group room" (v4) diff --git a/tests/php/Chat/ChatManagerTest.php b/tests/php/Chat/ChatManagerTest.php index 501376da1de..8d939cd42cd 100644 --- a/tests/php/Chat/ChatManagerTest.php +++ b/tests/php/Chat/ChatManagerTest.php @@ -735,7 +735,7 @@ public static function dataAddConversationNotify(): array { 'actor_id' => 'user', ])], 1, - [['id' => 'all', 'label' => 'test', 'source' => 'calls', 'mentionId' => 'all', 'details' => 'All 1 participant']], + [['id' => 'all', 'label' => 'test', 'source' => 'calls', 'mentionId' => 'all']], ], [ 'all',