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 2024-08-01] [$250] Emoji - Thumb emoji is displayed in frequently used every time when change the color #45262

Closed
4 of 6 tasks
izarutskaya opened this issue Jul 11, 2024 · 23 comments
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

@izarutskaya
Copy link

izarutskaya commented Jul 11, 2024

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


Version Number: 9.0.6-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): gocemate+a614@gmail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Go to any chat
  2. Type :+1 emoji and send
  3. Click on emoji symbol> Change default skin tone
  4. Type :+1 emoji and send
  5. Click on emoji symbol
  6. Check Frequently used section

Expected Result:

Only one thumb emoji should be displayed

Actual Result:

Thumb emoji is displayed in frequently used every time when change the color and send to chat

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6538754_1720691380465.Recording__3490.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019afad155d77a1825
  • Upwork Job ID: 1812957552878135707
  • Last Price Increase: 2024-07-15
  • Automatic offers:
    • nyomanjyotisa | Contributor | 103163861
    • situchan | Reviewer | 103164237
    • c3024 | Contributor | 103164238
Issue OwnerCurrent Issue Owner: @johncschuster
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 11, 2024
Copy link

melvin-bot bot commented Jul 11, 2024

Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@izarutskaya
Copy link
Author

We think this issue might be related to the #vip-vsb.

@daledah
Copy link
Contributor

daledah commented Jul 11, 2024

Proposal

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

Thumb emoji is displayed in frequently used every time when change the color and send to chat

What is the root cause of that problem?

Currently, we only store the emoji code and count in Onyx and 2 emoji codes 👍🏻👍 will be considered 2 different emojis

Screenshot 2024-07-11 at 22 24 53

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

When we get frequenty use emojis from Onyx, We should delete emojis with duplicate names to get unique names and recalculate the count by adding the other counts together

.filter((emoji): emoji is FrequentlyUsedEmoji => !!emoji) ?? [];

What alternative solutions did you explore? (Optional)

We should save frequenty use emojis with name, count and lastUpdatedAt to Onyx

@nyomanjyotisa
Copy link
Contributor

Proposal

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

emoji is displayed in frequently used every time when change the color

What is the root cause of that problem?

On the AddComment API response, each variant of the same emoji (with different skin tones) is treated as a separate entry due to unique emoji codes for each variant.

Here is the example frequent emoji onyx data in the API response

       {
            "key": "nvp_expensify_frequentlyUsedEmojis",
            "onyxMethod": "set",
            "value": [
                {
                    "code": "\ud83d\ude00",
                    "count": 3,
                    "lastUpdatedAt": 1720716420
                },
                {
                    "code": "\ud83d\udc4d",
                    "count": 2,
                    "lastUpdatedAt": 1720717020
                },
                {
                    "code": "\ud83d\udc4d\ud83c\udffe",
                    "count": 2,
                    "lastUpdatedAt": 1720714440
                },
                {
                    "code": "\ud83d\udc4d\ud83c\udffb",
                    "count": 2,
                    "lastUpdatedAt": 1720714380
                },
                {
                    "code": "\ud83d\ude01",
                    "count": 1,
                    "lastUpdatedAt": 1720714380
                },
                {
                    "code": "\ud83d\ude06",
                    "count": 1,
                    "lastUpdatedAt": 1720714380
                }
            ]
        },

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

Merge Duplicate Emojis and ensure to summing their count and use the latest lastUpdatedAt timestamp. Then sort accordingly to ensure the most used emojis are on the left, and if the count sum of 2 or more emojis the same, put the emoji with the latest lastUpdatedAt on the left

Add the following code after this code

        const emojiMap = new Map();

        frequentlyUsedEmojis.forEach((emoji) => {
            if (emojiMap.has(emoji.code)) {
                const existingEmoji = emojiMap.get(emoji.code);
                emojiMap.set(emoji.code, {
                    ...emoji,
                    count: existingEmoji.count + emoji.count,
                    lastUpdatedAt: Math.max(existingEmoji.lastUpdatedAt, emoji.lastUpdatedAt)
                });
            } else {
                emojiMap.set(emoji.code, emoji);
            }
        });

        frequentlyUsedEmojis = Array.from(emojiMap.values()).sort((a, b) => {
            if (a.count !== b.count) {
                return b.count - a.count;
            } else {
                return b.lastUpdatedAt - a.lastUpdatedAt;
            }
        });

RESULT

New-Expensify.8.mp4

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Jul 15, 2024
@johncschuster johncschuster added the External Added to denote the issue can be worked on by a contributor label Jul 15, 2024
@melvin-bot melvin-bot bot changed the title Emoji - Thumb emoji is displayed in frequently used every time when change the color [$250] Emoji - Thumb emoji is displayed in frequently used every time when change the color Jul 15, 2024
Copy link

melvin-bot bot commented Jul 15, 2024

Job added to Upwork: https://www.upwork.com/jobs/~019afad155d77a1825

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 15, 2024
Copy link

melvin-bot bot commented Jul 15, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jul 15, 2024
@c3024
Copy link
Contributor

c3024 commented Jul 16, 2024

Since the response from backend has duplicates this should ideally be fixed from backend.

However, I found another issue here. We are not adding the recently used emojis to the frequently used emojis optimistically. This does not fall directly under the scope of this bug. But we might consider fixing that. This would be a frontend fix.

🎀 👀 🎀 C+ Reviewed for Internal Engineer's decision

Copy link

melvin-bot bot commented Jul 16, 2024

Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@Beamanator
Copy link
Contributor

@marcaaron it looks like you've been all over the AddComment updates recently, do you have time to take a look at this one?

@Beamanator
Copy link
Contributor

OK it looooks like this could have been caused by some recent changes in #42208? (cc @jasperhuangg ) mind taking a look?

@jasperhuangg
Copy link
Contributor

Oh woops, this definitely looks like a regression from my UpdateFrequentlyUsedEmojis performance improvement PRs. I'll look into this. Definitely a back-end bug.

@jasperhuangg jasperhuangg added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Jul 16, 2024
@jasperhuangg jasperhuangg assigned jasperhuangg and unassigned c3024 Jul 16, 2024
@jasperhuangg
Copy link
Contributor

@c3024 unassigning you since this requires a back-end fix

@jasperhuangg
Copy link
Contributor

Looking into this today

@jasperhuangg jasperhuangg removed the Internal Requires API changes or must be handled by Expensify staff label Jul 17, 2024
@jasperhuangg jasperhuangg added External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Jul 17, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

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

Copy link

melvin-bot bot commented Jul 17, 2024

📣 @nyomanjyotisa 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@jasperhuangg
Copy link
Contributor

Hmm I investigated a fix in the back-end, but I don't think it's worth going down that rabbit hole since C++ isn't set up to handle emoji codes well.

I looked over the proposals and think the one from @nyomanjyotisa makes the most sense. Going to go ahead and assign them. Let's make sure to leave some good comments in your PR explaining why we're doing so. Thanks everyone!

@c3024
Copy link
Contributor

c3024 commented Jul 17, 2024

@jasperhuangg I was the original c+ for this issue. Could you please assign me back?

Copy link

melvin-bot bot commented Jul 17, 2024

📣 @situchan 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 17, 2024

📣 @c3024 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Jul 19, 2024
@melvin-bot melvin-bot bot changed the title [$250] Emoji - Thumb emoji is displayed in frequently used every time when change the color [HOLD for payment 2024-08-01] [$250] Emoji - Thumb emoji is displayed in frequently used every time when change the color Jul 25, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 25, 2024
Copy link

melvin-bot bot commented Jul 25, 2024

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

Copy link

melvin-bot bot commented Jul 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.11-5 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 2024-08-01. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jul 25, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@c3024] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 31, 2024
@c3024
Copy link
Contributor

c3024 commented Aug 1, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: No specific PR can be held responsible. This stemmed likely from a backend PR and the author of the PR is aware of it.
  • [@c3024] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: Same as above
  • [@c3024] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: No discussion was started because this could not be identified earlier.
  • [@c3024] Determine if we should create a regression test for this bug. Yes
  • [@c3024] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Proposal

  1. Go to any chat
  2. Type :+1: emoji (or any other emoji) in the composer and send
  3. Click on emoji picker in the composer -> Change default skin tone to a different skin tone > Close the emoji picker
  4. Type the same emoji in Step 2 in the composer and send
  5. Click on emoji picker in the composer again
  6. Verify there is no duplicate of any emoji in Frequently Used section

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
No open projects
Archived in project
Development

No branches or pull requests

8 participants