kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge branch 'heart-react' into develop
commit
983394a242
|
@ -16,7 +16,7 @@ exports[`<EmojiSelector /> renders correctly 1`] = `
|
||||||
className="emoji-react-selector__emoji"
|
className="emoji-react-selector__emoji"
|
||||||
dangerouslySetInnerHTML={
|
dangerouslySetInnerHTML={
|
||||||
Object {
|
Object {
|
||||||
"__html": "<img draggable=\\"false\\" class=\\"emojione\\" alt=\\"❤\\" title=\\":heart:\\" src=\\"/emoji/2764.svg\\" />",
|
"__html": "<img draggable=\\"false\\" class=\\"emojione\\" alt=\\"❤️\\" title=\\":heart:\\" src=\\"/emoji/2764.svg\\" />",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -158,7 +158,7 @@ describe('getReactForStatus', () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(getReactForStatus(status)).toEqual('❤');
|
expect(getReactForStatus(status, ALLOWED_EMOJI)).toEqual('❤');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns a thumbs-up for a favourite', () => {
|
it('returns a thumbs-up for a favourite', () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
// I've customized them.
|
// I've customized them.
|
||||||
export const ALLOWED_EMOJI = [
|
export const ALLOWED_EMOJI = [
|
||||||
'👍',
|
'👍',
|
||||||
'❤',
|
'❤️',
|
||||||
'😆',
|
'😆',
|
||||||
'😮',
|
'😮',
|
||||||
'😢',
|
'😢',
|
||||||
|
@ -75,11 +75,12 @@ export const reduceEmoji = (emojiReacts, favouritesCount, favourited, allowedEmo
|
||||||
emojiReacts, favouritesCount, favourited,
|
emojiReacts, favouritesCount, favourited,
|
||||||
))), allowedEmoji));
|
))), allowedEmoji));
|
||||||
|
|
||||||
export const getReactForStatus = status => {
|
export const getReactForStatus = (status, allowedEmoji=ALLOWED_EMOJI) => {
|
||||||
return reduceEmoji(
|
return reduceEmoji(
|
||||||
status.getIn(['pleroma', 'emoji_reactions'], ImmutableList()),
|
status.getIn(['pleroma', 'emoji_reactions'], ImmutableList()),
|
||||||
status.get('favourites_count'),
|
status.get('favourites_count', 0),
|
||||||
status.get('favourited'),
|
status.get('favourited'),
|
||||||
|
allowedEmoji,
|
||||||
).filter(e => e.get('me') === true)
|
).filter(e => e.get('me') === true)
|
||||||
.getIn([0, 'name']);
|
.getIn([0, 'name']);
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue