diff --git a/app/gabsocial/utils/__tests__/emoji_reacts-test.js b/app/gabsocial/utils/__tests__/emoji_reacts-test.js index f0577c582..6acb5ec09 100644 --- a/app/gabsocial/utils/__tests__/emoji_reacts-test.js +++ b/app/gabsocial/utils/__tests__/emoji_reacts-test.js @@ -79,6 +79,12 @@ describe('mergeEmojiFavourites', () => { { 'count': 12, 'me': false, 'name': '👍' }, ])); }); + it('does not add 👍 reacts when there are no favourites', () => { + expect(mergeEmojiFavourites(emojiReacts, 0)).toEqual(fromJS([ + { 'count': 15, 'me': true, 'name': '❤️' }, + { 'count': 7, 'me': true, 'name': '😯' }, + ])); + }); }); }); diff --git a/app/gabsocial/utils/emoji_reacts.js b/app/gabsocial/utils/emoji_reacts.js index b2426b9a2..bb45da7d4 100644 --- a/app/gabsocial/utils/emoji_reacts.js +++ b/app/gabsocial/utils/emoji_reacts.js @@ -19,6 +19,7 @@ export const mergeEmoji = emojiReacts => ( ); export const mergeEmojiFavourites = (emojiReacts, favouritesCount) => { + if (!favouritesCount) return emojiReacts; const likeIndex = emojiReacts.findIndex(emojiReact => emojiReact.get('name') === '👍'); if (likeIndex > -1) {