sforkowany z mirror/soapbox
Don't add like reacts when there are no favourites
rodzic
d562a25c78
commit
3547fd093a
|
@ -79,6 +79,12 @@ describe('mergeEmojiFavourites', () => {
|
||||||
{ 'count': 12, 'me': false, 'name': '👍' },
|
{ '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) => {
|
export const mergeEmojiFavourites = (emojiReacts, favouritesCount) => {
|
||||||
|
if (!favouritesCount) return emojiReacts;
|
||||||
const likeIndex = emojiReacts.findIndex(emojiReact =>
|
const likeIndex = emojiReacts.findIndex(emojiReact =>
|
||||||
emojiReact.get('name') === '👍');
|
emojiReact.get('name') === '👍');
|
||||||
if (likeIndex > -1) {
|
if (likeIndex > -1) {
|
||||||
|
|
Ładowanie…
Reference in New Issue