Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32167654
D5974.1765052913.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
D5974.1765052913.diff
View Options
diff --git a/lib/shared/reaction-utils.js b/lib/shared/reaction-utils.js
--- a/lib/shared/reaction-utils.js
+++ b/lib/shared/reaction-utils.js
@@ -14,9 +14,11 @@
invariant(reactionInfo, 'reactionInfo should be set');
reactionText.push(reaction);
- if (reactionInfo.users.size > 1) {
- reactionText.push(reactionInfo.users.size);
+ const { size: numberOfReacts } = reactionInfo.users;
+ if (numberOfReacts <= 1) {
+ continue;
}
+ reactionText.push(numberOfReacts > 9 ? '9+' : numberOfReacts.toString());
}
return reactionText.join(' ');
diff --git a/lib/shared/reaction-utils.test.js b/lib/shared/reaction-utils.test.js
--- a/lib/shared/reaction-utils.test.js
+++ b/lib/shared/reaction-utils.test.js
@@ -110,5 +110,36 @@
expect(stringForReactionList(reactionsMap)).toBe('👍 😆 3');
},
);
+
+ it(
+ 'should return (👍 9+) for a message with 12 user likes' +
+ ' not including the viewer',
+ () => {
+ const messageLikesUsers = [
+ '86622',
+ '12345',
+ '67890',
+ '83889',
+ '49203',
+ '12932',
+ '83029',
+ '72902',
+ '49022',
+ '48902',
+ '80922',
+ '12890',
+ ];
+ const messageLikesUsersSet = new Set(messageLikesUsers);
+ const messageLikesInfo = {
+ users: messageLikesUsersSet,
+ viewerReacted: false,
+ };
+
+ const reactionsMap = new Map<string, MessageReactionInfo>();
+ reactionsMap.set('👍', messageLikesInfo);
+
+ expect(stringForReactionList(reactionsMap)).toBe('👍 9+');
+ },
+ );
},
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 8:28 PM (8 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840656
Default Alt Text
D5974.1765052913.diff (1 KB)
Attached To
Mode
D5974: [lib] modified stringForReactionList to handle more than 9 likes/reactions for the same reaction type
Attached
Detach File
Event Timeline
Log In to Comment