Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33105064
D6510.1768476062.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D6510.1768476062.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6510: [lib] Use pluralize in robotextForUsers
Attached
Detach File
Event Timeline
Log In to Comment