Skip to content

Commit

Permalink
Merge pull request #22662 from Expensify/stites-fixFrequentlyUsedEmojis
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl authored Jul 11, 2023
2 parents 032006b + 4e6d744 commit 1a4190b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/libs/EmojiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Onyx.connect({
frequentlyUsedEmojis = _.map(val, (item) => {
const emoji = Emojis.emojiCodeTable[item.code];
if (emoji) {
return {name: emoji.name, code: emoji.code, count: item.count, lastUpdatedAt: item.lastUpdatedAt};
return {...emoji, count: item.count, lastUpdatedAt: item.lastUpdatedAt};
}
});
},
Expand Down Expand Up @@ -228,8 +228,7 @@ function getFrequentlyUsedEmojis(newEmoji) {
frequentEmojiList.splice(emojiIndex, 1);
}

const {name, code} = Emojis.emojiCodeTable[emoji.code];
const updatedEmoji = {name, code, count: currentEmojiCount, lastUpdatedAt: currentTimestamp};
const updatedEmoji = {...Emojis.emojiCodeTable[emoji.code], count: currentEmojiCount, lastUpdatedAt: currentTimestamp};

// We want to make sure the current emoji is added to the list
// Hence, we take one less than the current frequent used emojis
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/EmojiTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ describe('EmojiTest', () => {
name: 'wave',
count: 2,
lastUpdatedAt: 4,
types: ['👋🏿', '👋🏾', '👋🏽', '👋🏼', '👋🏻'],
},
{
code: '💤',
Expand Down Expand Up @@ -234,6 +235,7 @@ describe('EmojiTest', () => {
name: 'wave',
count: 2,
lastUpdatedAt: 4,
types: ['👋🏿', '👋🏾', '👋🏽', '👋🏼', '👋🏻'],
},
{
code: '💤',
Expand Down Expand Up @@ -280,6 +282,7 @@ describe('EmojiTest', () => {
name: 'wave',
count: 2,
lastUpdatedAt: 4,
types: ['👋🏿', '👋🏾', '👋🏽', '👋🏼', '👋🏻'],
},
{...zzzEmoji, count: 2, lastUpdatedAt: 3},
{
Expand Down Expand Up @@ -329,6 +332,7 @@ describe('EmojiTest', () => {
name: 'wave',
count: 3,
lastUpdatedAt: 23,
types: ['👋🏿', '👋🏾', '👋🏽', '👋🏼', '👋🏻'],
},
{
code: '😡',
Expand Down Expand Up @@ -389,6 +393,7 @@ describe('EmojiTest', () => {
name: 'baby',
count: 3,
lastUpdatedAt: 13,
types: ['👶🏿', '👶🏾', '👶🏽', '👶🏼', '👶🏻'],
},
{
code: '👄',
Expand Down

0 comments on commit 1a4190b

Please sign in to comment.