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-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong #27464

Closed
1 of 6 tasks
kbecciv opened this issue Sep 14, 2023 · 40 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

@kbecciv
Copy link

kbecciv commented Sep 14, 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. Open any report
  2. Open the emoji picker
  3. Choose an emoji that is not in the frequently used emoji list
  4. Open the emoji picker again and see at what position this emoji is in the frequently used emoji list
  5. Close the emoji picker
  6. Type a lot of characters
  7. Open the emoji picker

Expected Result:

The emoji you chose should be at the same position in step 4 and step 7 because you didn't used it more

Actual Result:

The emoji you used is in the top position of the frequently used emoji

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.70.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: Any additional supporting documentation

2023-09-12.07-31-03.mp4
Recording.4477.mp4

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

View all open jobs on GitHub

@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 14, 2023
@melvin-bot melvin-bot bot changed the title Web - Frequently used emojis is listed wrong [$500] Web - Frequently used emojis is listed wrong Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Job added to Upwork: https://www.upwork.com/jobs/~013dbe1b2bb7790399

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 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

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

melvin-bot bot commented Sep 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

@kbecciv
Copy link
Author

kbecciv commented Sep 14, 2023

Proposal by: @ShogunFire
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694526008852389

Proposal

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

The frequently used emojis list is in the wrong order

What is the root cause of that problem?

We are updating the frequently used emojis with the emojis we inserted here:

const debouncedUpdateFrequentlyUsedEmojis = useCallback(() => {
User.updateFrequentlyUsedEmojis(EmojiUtils.getFrequentlyUsedEmojis(insertedEmojisRef.current));
insertedEmojisRef.current = [];
}, []);

And we are retrieving those emojis in updateComment here:
insertedEmojisRef.current = [...insertedEmojisRef.current, ...emojis];

The emojis are extracted from the text in replaceAndExtractEmojis
The problem with that method is that we are returning the emojis from the text even when they were already there before so at each character the user type we will add the same emojis which will make us think that we are using the emoji way more than what is actually happening

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

We need to save the emojis that were in the text before in a variable called emojisPresentBefore and the insertedEmojis variable that we use to update the frequently used emoji will be filled with emojis that are in this text minus the emojis from emojisPresentBefore.
The same behaviour is present in ReportActionItemMessageEdit so we need to do the same thing.

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

@ShogunFire It seems your solution will cause the regression, but I am not sure about that. To confirm could you help to detail your solution?

@ShogunFire
Copy link
Contributor

Proposal

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

The frequently used emojis list is in the wrong order

What is the root cause of that problem?

We are updating the frequently used emojis with the emojis we inserted here:

const debouncedUpdateFrequentlyUsedEmojis = useCallback(() => {
User.updateFrequentlyUsedEmojis(EmojiUtils.getFrequentlyUsedEmojis(insertedEmojisRef.current));
insertedEmojisRef.current = [];
}, []);

And we are retrieving those emojis in updateComment here:
insertedEmojisRef.current = [...insertedEmojisRef.current, ...emojis];

The emojis are extracted from the text in replaceAndExtractEmojis
The problem with that method is that we are returning the emojis from the text even when they were already there before so at each character the user type we will add the same emojis which will make us think that we are using the emoji way more than what is actually happening

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

We need to save the emojis that were in the text before in a variable called emojisPresentBefore and the insertedEmojis variable that we use to update the frequently used emoji will be filled with emojis that are in this text minus the emojis from emojisPresentBefore.

  1. emojisPresentBefore must be filled with the emojis present in the drafts to avoid sending the draft emojis twice:
var emojisPresentBefore = [];
const [value, setValue] = useState(() => {
    const draft = getDraftComment(reportID) || '';
    if (draft) {
        emojisPresentBefore = EmojiUtils.extractEmojis(draft);
    }
    return draft;
});
  1. We can remove the callback onInsertedEmoji because the emojis inserted with suggestion list will be parsed and added in the frequent emojis list in updateComment like the other emojis

  2. In update comment we fill insertedEmojis only with the new emojis like this:

const newEmojis = EmojiUtils.getAddedEmojis(emojis, emojisPresentBefore);

insertedEmojisRef.current = [...insertedEmojisRef.current, ...newEmojis];

And after that we also update emojisPresentBefore in every cases even if there is no emoji

  1. The new method getAddedEmojis looks like this for now: Maybe there is a better way to get the new emojis:
function getAddedEmojis(currentEmojis, formerEmojis){
    
    let newEmojis = [...currentEmojis];
    // We are removing the emojis from the newEmojis array if they were already present before.
    formerEmojis.forEach((formerEmoji) => {
        const indexOfAlreadyPresentEmoji = newEmojis.findIndex(newEmoji => newEmoji.code == formerEmoji.code);
        if(indexOfAlreadyPresentEmoji >= 0) {
            newEmojis.splice(indexOfAlreadyPresentEmoji, 1);
        }
    });
    return newEmojis;
}
  1. Right now extractEmojis method only returns 1 time the emojis even if there are 3 occurences of the same emoji, we need to return the 3 occurences

The same behaviour is present in ReportActionItemMessageEdit so we need to do the same thing.

This is just the primary version but here is my branch that is working fine for ComposerWithSuggestions:
https://github.com/ShogunFire/App/tree/fixFrequentlyUsedEmojiSentMultipleTimes

What alternative solutions did you explore? (Optional)

@ShogunFire
Copy link
Contributor

@DylanDylann I couldn't edit the proposal but yes this was a little more complex than I thought, I hope the regression you were speaking about is not present with that version

@mananjadhav
Copy link
Collaborator

I think @ShogunFire's proposal will work. It looks a bit complex and we can try to simplify during the PR stage. For instance, @ShogunFire will this simplify your getAddedEmojis logic, if I understand it correct?

function getAddedEmojis(currentEmojis, formerEmojis) {
    return currentEmojis.filter((currentEmoji) => {
        return !formerEmojis.some((formerEmoji) => currentEmoji.code === formerEmoji.code);
    });
}

🎀 👀 🎀 C+ reviewed.

@melvin-bot
Copy link

melvin-bot bot commented Sep 17, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 18, 2023
@ShogunFire
Copy link
Contributor

@mananjadhav Thanks, I don't think we can do that because if we have "🙂" before and "🙂🙂" after I think we need to update the count of the emoji so getAddedEmojis has to return 1 🙂. I will think of a better way to do that but it looks kind of hard to make it simple.

@Pujan92

This comment was marked as outdated.

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 18, 2023

@Pujan92

emojis: emojis.concat(extractEmojis(text)), 

This is a feature, we can't remove it
ref: #21786

@Pujan92
Copy link
Contributor

Pujan92 commented Sep 18, 2023

emojis: emojis.concat(extractEmojis(text)),

This is a feature, we can't remove it ref: #21786

Thanks @DylanDylann , I tried but wasn't able to find this ref earlier.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 13, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.83-11 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-10-20. 🎊

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

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

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 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:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] 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:
  • [@mananjadhav] 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:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] 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.
  • [@stephanieelliott] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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-10-23. 🎊

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

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

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 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:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] 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:
  • [@mananjadhav] 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:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] 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.
  • [@stephanieelliott] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] Web - Frequently used emojis is listed wrong Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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-10-23. 🎊

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

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

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 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:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] 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:
  • [@mananjadhav] 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:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] 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.
  • [@stephanieelliott] 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 Overdue and removed Weekly KSv2 labels Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

@mananjadhav, @joelbettner, @ShogunFire, @stephanieelliott Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@joelbettner
Copy link
Contributor

joelbettner commented Oct 23, 2023

I'm so confused...

It took me forever to get to this since I was working on other high-priority, time sensitive issues. But...it looks like the soltion for this has already been merged/deployed?? (cc: @mananjadhav @stephanieelliott @ShogunFire)

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@stephanieelliott
Copy link
Contributor

Ya Melvin kirked out on this one, it's a single PR that triggered the automation multiple times. Everything is done here though, just needs to be paid out!

Summarizing payment:

Upwork job is here, not eligible for bonus

@stephanieelliott
Copy link
Contributor

@ShogunFire I extended the offer to you in Upwork, can you please accept when you get a chance? Thanks! https://www.upwork.com/jobs/~01bec5d8c4497434db

@ShogunFire
Copy link
Contributor

@stephanieelliott thanks , I did

@mananjadhav
Copy link
Collaborator

I've raised the request on NewDot.

@JmillsExpensify
Copy link

$500 payment approved for @mananjadhav based on summary above.

@stephanieelliott
Copy link
Contributor

All paid!

@ShogunFire
Copy link
Contributor

Hello @stephanieelliott , sorry for the late request but could you please put the upwork mission as complete ? It still shows as in progress on my profile. Thanks

@stephanieelliott
Copy link
Contributor

Hey @ShogunFire no problem. I saw your email come through and have I closed this contract as well as the other 2 completed contracts that were still active on your profile (#20998, #19389)

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

9 participants