Page MenuHomePhorge

D5974.1765052913.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D5974.1765052913.diff

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

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)

Event Timeline