Fix reaction_deck api structure
This commit is contained in:
parent
3f9a75c72f
commit
f382b16fde
3 changed files with 55 additions and 7 deletions
|
@ -45,7 +45,7 @@ const getFrequentlyUsedEmojis = createSelector([
|
|||
const { emojiCounters, reactionDeck } = data;
|
||||
let deckEmojis = reactionDeck
|
||||
.toArray()
|
||||
.map((e) => e.get('emoji'))
|
||||
.map((e) => e.getIn(['emoji', 'shortcode']))
|
||||
.filter((e) => e)
|
||||
.map((e) => shortCodes[e] || e);
|
||||
deckEmojis = [...new Set(deckEmojis)];
|
||||
|
@ -70,6 +70,8 @@ const getFrequentlyUsedEmojis = createSelector([
|
|||
|
||||
emojis = deckEmojis.slice(0, DECK_SIZE).concat(emojis);
|
||||
|
||||
if (emojis.length <= 0) emojis = ['+1'];
|
||||
|
||||
return emojis;
|
||||
});
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import emojify from 'mastodon/features/emoji/emoji';
|
|||
import { autoPlayGif } from 'mastodon/initial_state';
|
||||
|
||||
const MapStateToProps = (state, { emojiId, emojiMap }) => ({
|
||||
emoji: (state.get('reaction_deck', ImmutableList()).toArray().find(em => em.get('id') === emojiId) || ImmutableMap({ emoji: '' })).get('emoji'),
|
||||
emoji: (state.get('reaction_deck', ImmutableList()).toArray().find(em => em.get('id') === emojiId) || ImmutableMap({ emoji: { shortcode: '' } })).getIn(['emoji', 'shortcode']),
|
||||
emojiMap,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue