Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2023-02-28] [$1000] Emoji skin tone colors aren't working/updating #14876

Closed
2 tasks
kavimuru opened this issue Feb 6, 2023 · 56 comments
Closed
2 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Feb 6, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Change skin tone for emoji
  2. Send emoji

Expected Result:

New skin tone to show

Actual Result:

Old skin tone shows

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • MacOS / FF
  • MacOS / Desktop

Version Number: 1.2.65-2
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

2023-02-02_16-01-32.mp4
Recording.90.mp4

Expensify/Expensify Issue URL:
Issue reported by: @mallenexpensify
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1675437076355079

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fcdc6fa826648131
  • Upwork Job ID: 1623105845829398528
  • Last Price Increase: 2023-02-14
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 6, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 6, 2023
@MelvinBot
Copy link

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@MelvinBot
Copy link

MelvinBot commented Feb 6, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@stitesExpensify
Copy link
Contributor

I was able to reproduce this, but it is not consistent. I also noticed that when searching in the picker, skin tone is not reflected (hand was the easiest example).

@stitesExpensify stitesExpensify added the External Added to denote the issue can be worked on by a contributor label Feb 7, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 7, 2023
@melvin-bot melvin-bot bot changed the title Emoji skin tone colors aren't working/updating [$1000] Emoji skin tone colors aren't working/updating Feb 7, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~01fcdc6fa826648131

@MelvinBot
Copy link

Triggered auto assignment to @joekaufmanexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 7, 2023
@MelvinBot
Copy link

Current assignee @stitesExpensify is eligible for the External assigner, not assigning anyone new.

@tienifr
Copy link
Contributor

tienifr commented Feb 8, 2023

Proposal

Problem

In

const emojiCode = types && types[this.props.preferredSkinTone]
? types[this.props.preferredSkinTone]
: code;

We need types to render the emojiCode with preferredSkinTone

But in

if (emojis[i].keywords) {
for (let j = 0; j < emojis[i].keywords.length; j++) {
const keywordNode = emojisTrie.search(emojis[i].keywords[j]);
if (!keywordNode) {
emojisTrie.add(emojis[i].keywords[j], {suggestions: [{code: emojis[i].code, name: emojis[i].name}]});
} else {
emojisTrie.update(emojis[i].keywords[j],
{...keywordNode.metaData, suggestions: [...keywordNode.metaData.suggestions, {code: emojis[i].code, name: emojis[i].name}]});
}
}
}

when add emoji to emojisTrie but we don't pass the types

Solution

diff --git a/src/libs/EmojiTrie.js b/src/libs/EmojiTrie.js
index 5d7a15dbf..6e3618c7b 100644
--- a/src/libs/EmojiTrie.js
+++ b/src/libs/EmojiTrie.js
@@ -6,25 +6,24 @@ import CONST from '../CONST';
 Timing.start(CONST.TIMING.TRIE_INITIALIZATION);
 
 const emojisTrie = new Trie();

 // Inserting all emojis into the Trie object
 for (let i = 0; i < emojis.length; i++) {
     if (emojis[i].name) {
         const node = emojisTrie.search(emojis[i].name);
         if (!node) {
-            emojisTrie.add(emojis[i].name, {code: emojis[i].code, suggestions: []});
+            emojisTrie.add(emojis[i].name, {code: emojis[i].code, suggestions: [],types:emojis[i].types});
         } else {
-            emojisTrie.update(emojis[i].name, {code: emojis[i].code, suggestions: node.metaData.suggestions});
+            emojisTrie.update(emojis[i].name, {code: emojis[i].code, suggestions: node.metaData.suggestions,types:emojis[i].types});
         }
 
         if (emojis[i].keywords) {
             for (let j = 0; j < emojis[i].keywords.length; j++) {
                 const keywordNode = emojisTrie.search(emojis[i].keywords[j]);
                 if (!keywordNode) {
-                    emojisTrie.add(emojis[i].keywords[j], {suggestions: [{code: emojis[i].code, name: emojis[i].name}]});
+                    emojisTrie.add(emojis[i].keywords[j], {suggestions: [{code: emojis[i].code, name: emojis[i].name,types:emojis[i].types}],types:emojis[i].types});
                 } else {
                     emojisTrie.update(emojis[i].keywords[j],
-                        {...keywordNode.metaData, suggestions: [...keywordNode.metaData.suggestions,  {code: emojis[i].code, name: emojis[i].name}]});
+                        {...keywordNode.metaData, suggestions: [...keywordNode.metaData.suggestions,  {code: emojis[i].code, name: emojis[i].name,types:emojis[i].types}]});
                 }
             }
         }
diff --git a/src/libs/EmojiUtils.js b/src/libs/EmojiUtils.js
index d6ed8875e..98b46f1d8 100644
--- a/src/libs/EmojiUtils.js
+++ b/src/libs/EmojiUtils.js
@@ -228,7 +228,7 @@ function suggestEmojis(text, limit = 5) {
                 if (matching.length === limit) {
                     return matching;
                 }
-                matching.push({code: nodes[j].metaData.code, name: nodes[j].name});
+                matching.push({code: nodes[j].metaData.code, name: nodes[j].name,types:nodes[j].metaData.types});
             }
             const suggestions = nodes[j].metaData.suggestions;
             for (let i = 0; i < suggestions.length; i++) {

Result

Screen Shot 2023-02-08 at 08 46 55

@fedirjh
Copy link
Contributor

fedirjh commented Feb 8, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Emoji skin tone colors aren't applied to filtered emoji . when you try to search for emoji , the list of filtered emoji doesn’t have the skin tone color applied to it.

What is the root cause of that problem?

Bug 1 :

when we search for an emoji we use the default emoji list, the emojisTrie doesn’t not return emoji.types alongside with emoji.code and emoji.name (this is missing), hence the filtered list of emoji will be displayed with the default skin tone because types is undefined for filtered emojis

const emojiCode = types && types[this.props.preferredSkinTone]
? types[this.props.preferredSkinTone]
: code;

Bug 2 :

This i the bug that @mallenexpensify reported here. Here is the Explanation :

  1. Because of bug 1 , when we search an emoji it doesn’t include types (which used to switch skin tone)
  2. When we use the searched emoji , it will be pushed to frequentlyUsedEmojis (without types)
  3. The frequentlyUsedEmojis is saved on server and in Onyx with types missing
  4. The frequentlyUsedEmojis is then displayed with an outdated version of emojis which is missing types

Here is demo before the fix

Screen.Recording.2023-02-09.at.8.02.57.PM.mov

After the Fix

Screen.Recording.2023-02-09.at.8.05.14.PM.mov

What changes do you think we should make in order to solve the problem?

Bug 1

  1. We should update the emojisTrie to return the types property of every emoji.
emojisTrie.add(
    emojis[i].name,
    {
        code: emojis[i].code,
        types: emojis[i].types, // we should add this line and add it in other places too
        suggestions: [],
    },
);
  1. We should update the suggestEmojis util to include emoji.types too
matching.push({
    code: nodes[j].metaData.code,
    name: nodes[j].name,
    types: nodes[j].metaData.types,// we should add this line
});

Result

Screen.Recording.2023-02-08.at.2.01.46.AM.mov

Bug 2

We should add the missing types to this.props.frequentlyUsedEmojis

const emojiMap = new Map(_.map(emojis, emoji => [emoji.code, emoji]));

const emojisWithTypes = _.map(
    this.props.frequentlyUsedEmojis,
    emoji => lodashMerge(emoji, emojiMap.get(emoji.code)),
);

const allEmojis = EmojiUtils.mergeEmojisWithFrequentlyUsedEmojis(emojis, emojisWithTypes);

What alternative solutions did you explore? (Optional)

@Santhosh-Sellavel
Copy link
Collaborator

I will not be able to get this sooner, so unassigning it. Please reapply External label @stitesExpensify @joekaufmanexpensify

@Santhosh-Sellavel Santhosh-Sellavel removed their assignment Feb 8, 2023
@stitesExpensify stitesExpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Feb 8, 2023
@MelvinBot
Copy link

Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

@MelvinBot
Copy link

Current assignee @stitesExpensify is eligible for the External assigner, not assigning anyone new.

@joekaufmanexpensify
Copy link
Contributor

I was able to reproduce this, but it is not consistent.

@stitesExpensify Are there specific steps you were able to follow to reproduce what Matt sent in the video? I can't reproduce the aspect where we show emojis with the default skin tone in the emoji picker after changing the skin tone setting.

I also noticed that when searching in the picker, skin tone is not reflected (hand was the easiest example).

I can reproduce this specific aspect of the issue though.

@fedirjh
Copy link
Contributor

fedirjh commented Feb 15, 2023

@parasharrajat #15191 ready for review

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Feb 21, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Emoji skin tone colors aren't working/updating [HOLD for payment 2023-02-28] [$1000] Emoji skin tone colors aren't working/updating Feb 21, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 21, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

MelvinBot commented Feb 21, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.74-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-02-28. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

MelvinBot commented Feb 21, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@fedirjh
Copy link
Contributor

fedirjh commented Feb 23, 2023

Regression Test Proposal

  • Open any chat
  • Change skin tone for emoji
  • Send emoji
  • Verify that the emoji reflects the selected skin tone
  • Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 27, 2023
@joekaufmanexpensify
Copy link
Contributor

Regression test steps look good to me! I'll work on adding it. Besides that, all that's left before we can issue payment is for @parasharrajat / @stitesExpensify to complete the other BZ checklist items.

@joekaufmanexpensify
Copy link
Contributor

Regression test is here!

@joekaufmanexpensify
Copy link
Contributor

All that's left before we can issue payment here are the remaining engineering BZ checklist steps.

@joekaufmanexpensify
Copy link
Contributor

bump @parasharrajat @bstites, could you fill out the remaining portion of the BZ checklist when you have a chance?

@joekaufmanexpensify
Copy link
Contributor

Still pending completion of remaining BZ checklist.

@parasharrajat
Copy link
Member

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

It is clearly a failure scenario for testing a feature completely. I guess we already have steps in place so nothing is needed. We should make sure to test the feature completely during reviews.

@joekaufmanexpensify
Copy link
Contributor

Awesome, ty! Updated that info into the BZ checklist.

@joekaufmanexpensify
Copy link
Contributor

All set to issue payment here. @fedirjh was assigned to this issue on 2023-02-15 and the PR was merged on 2023-02-17, so this qualifies for a 50% speed bonus. Great job! We need to issue the following payment:

  • @fedirjh $1,500 ($1,000 for bug, and $500 speed bonus).
  • @parasharrajat $1,500 ($1,000 for C+ review, and $500 speed bonus).

@joekaufmanexpensify
Copy link
Contributor

@fedirjh offer sent for $1,000 (we'll add $500 as a bonus when paying)!

@joekaufmanexpensify
Copy link
Contributor

@parasharrajat offer sent for $1,000 (we'll add $500 as a bonus when paying)!

@fedirjh
Copy link
Contributor

fedirjh commented Mar 3, 2023

@fedirjh offer sent for $1,000 (we'll add $500 as a bonus when paying)!

@joekaufmanexpensify Thank you, accepted.

@joekaufmanexpensify
Copy link
Contributor

@parasharrajat $1,500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@fedirjh $1,500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

Bug is fixed, BZ checklist complete, and all payment issued. This is all set. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

10 participants