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 @@ -15,7 +15,12 @@ reactionText.push(reaction); if (reactionInfo.users.size > 1) { - reactionText.push(reactionInfo.users.size); + let numOfReacts = reactionInfo.users.size; + if (numOfReacts > 9) { + numOfReacts = '9+'; + } + + reactionText.push(numOfReacts); } } 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(); + reactionsMap.set('👍', messageLikesInfo); + + expect(stringForReactionList(reactionsMap)).toBe('👍 9+'); + }, + ); }, );