Page MenuHomePhorge

D6510.1768476062.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D6510.1768476062.diff

diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js
--- a/lib/shared/message-utils.js
+++ b/lib/shared/message-utils.js
@@ -32,6 +32,7 @@
import { type ThreadInfo } from '../types/thread-types';
import type { RelativeUserInfo, UserInfos } from '../types/user-types';
import { type EntityText, entityTextToRawString } from '../utils/entity-text';
+import { pluralize } from '../utils/text-utils';
import { codeBlockRegex, type ParserRules } from './markdown';
import { messageSpecs } from './messages/message-specs';
import { threadIsGroupChat } from './thread-utils';
@@ -67,21 +68,7 @@
}
function robotextForUsers(users: RelativeUserInfo[]): string {
- if (users.length === 1) {
- return robotextForUser(users[0]);
- } else if (users.length === 2) {
- return `${robotextForUser(users[0])} and ${robotextForUser(users[1])}`;
- } else if (users.length === 3) {
- return (
- `${robotextForUser(users[0])}, ${robotextForUser(users[1])}, ` +
- `and ${robotextForUser(users[2])}`
- );
- } else {
- return (
- `${robotextForUser(users[0])}, ${robotextForUser(users[1])}, ` +
- `and ${users.length - 2} others`
- );
- }
+ return pluralize(users.map(robotextForUser), 3);
}
function encodedThreadEntity(threadID: string, text: string): string {

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 11:21 AM (9 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5937502
Default Alt Text
D6510.1768476062.diff (1 KB)

Event Timeline