Don't add like reacts when there are no favourites
This commit is contained in:
parent
d562a25c78
commit
3547fd093a
2 changed files with 7 additions and 0 deletions
|
@ -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': '😯' },
|
||||
]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue