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-05-22] [$1000] App crashes when right clicking on a reaction once sender react to message with multiple emoji tone color, and recipient reacts to it #18552

Closed
1 of 6 tasks
kavimuru opened this issue May 7, 2023 · 26 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

@kavimuru
Copy link

kavimuru commented May 7, 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 an existing group chat (account A)
  2. Send a message
  3. Hover over the message and react to the message with emoji
  4. Change skin tone and add the same emoji reaction to the existing emoji reaction
  5. On another window open the group chat with one of the group participants account (account B)
  6. Add the same emoji reaction to the message (add same emoji)
  7. Shift windows to account A , and right click on the reacted emoji

Expected Result:

System should display the list of user that has reacted with the emoji

Actual Result:

App crashes down

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.11.2
Reproducible in staging?: y
Reproducible in production?: new feature
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-05-06.10.23.31.mp4
Recording.515.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Natnael-Guchima
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1683358345695579

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01262eda193a5f33e9
  • Upwork Job ID: 1655595017535242240
  • Last Price Increase: 2023-05-08
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 7, 2023

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

@melvin-bot
Copy link

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

@Natnael-Guchima
Copy link

This bug seems to be related with this PR -> #15685

@hungvu193
Copy link
Contributor

hungvu193 commented May 8, 2023

Proposal

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

App crashes when right clicking on a reaction once sender react to message with multiple emoji tone color, and recipient reacts to it.

What is the root cause of that problem?

We are calculating reaction users in this line:

 const reactionUsers = _.map(reaction.users, sender => sender.accountID.toString());

When user changed the skin stone and reacted to the message, the reactionUsers will have duplicate item in it.
For example:  ['12736676', '12736676', '12736676', '12812778']
Now, let take a look at the function we used to get the users from reactionUsers above:

function getPersonalDetailsByIDs(accountIDs, shouldChangeUserDisplayName = false) {
const result = [];
const currentAccountID = Report.getCurrentUserAccountID();
_.each(personalDetails, (detail) => {
for (let i = 0; i < accountIDs.length; i++) {
if (detail.accountID === accountIDs[i]) {
if (shouldChangeUserDisplayName && currentAccountID.toString() === detail.accountID) {
result[i] = {
...detail,
displayName: Localize.translateLocal('common.you'),
};
} else {
result[i] = detail;
}
break;
}
}
});
return result;

Let take a look at line 33, right after we found the result we want, we break the loop. So when our array has duplicate item like my example, after the first one was found, the loop break and move to the next item, the next 2 duplicated will not be found. So the result array will look like this:
Screenshot 2023-05-08 at 12 50 42

firstitem
undefined
undefined
thirditem

Because there were 2 items are undefined, the app will crash while user right click to open reaction list modal, because the list used the key extractor from the item, when item is undefined it will cause the crash.

const keyExtractor = (item, index) => `${item.login}+${index}`;

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

We have few solutions here:

  1. Make the reactionUsers list unique. (We can use underscore unique function to do that).
  2. Update the getPersonalDetailsByIDs. Instead of assigning the current index of the loop for the result array, we should calculate the next index for the result array.
                const currentIndex = result.length === 0 ? 0 : result.length;
                if (shouldChangeUserDisplayName && currentAccountID.toString() === detail.accountID) {
                    result[currentIndex] = {
                        ...detail,
                        displayName: Localize.translateLocal('common.you'),
                    };
                } else {
                    result[currentIndex] = detail;
                }
                break;

What alternative solutions did you explore? (Optional)

@parasharrajat
Copy link
Member

parasharrajat commented May 8, 2023

As this issue originated from #15685, even though not directly related to the changes on the PR, this will be handled by the same author.

Thanks for the proposals.

@abekkala Please assign me as C+ to it.

@abekkala abekkala added the External Added to denote the issue can be worked on by a contributor label May 8, 2023
@melvin-bot melvin-bot bot changed the title App crashes when right clicking on a reaction once sender react to message with multiple emoji tone color, and recipient reacts to it [$1000] App crashes when right clicking on a reaction once sender react to message with multiple emoji tone color, and recipient reacts to it May 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01262eda193a5f33e9

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

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

melvin-bot bot commented May 8, 2023

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

@abekkala abekkala assigned parasharrajat and unassigned mollfpr May 8, 2023
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

📣 @parasharrajat You have been assigned to this job by @abekkala!
Please apply to this job in Upwork 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 Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 15, 2023
@melvin-bot melvin-bot bot changed the title [$1000] App crashes when right clicking on a reaction once sender react to message with multiple emoji tone color, and recipient reacts to it [HOLD for payment 2023-05-22] [$1000] App crashes when right clicking on a reaction once sender react to message with multiple emoji tone color, and recipient reacts to it May 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.13-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 2023-05-22. 🎊

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

@melvin-bot
Copy link

melvin-bot bot commented May 15, 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:

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

@abekkala
Copy link
Contributor

@parasharrajat when you have a moment can you complete the checklist items above?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 21, 2023
@abekkala
Copy link
Contributor

@parasharrajat once the checklist is done I can complete payments

@parasharrajat
Copy link
Member

[@parasharrajat] The PR that introduced the bug has been identified. Link to the PR: #15685

[@parasharrajat] 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: #15685

[@parasharrajat] 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: Not needed. This was a mistake

[@parasharrajat] Determine if we should create a regression test for this bug. No, it is was an internal change that does not have any UI effect.

@abekkala
Copy link
Contributor

Payments to be made:

Issue reported by: @Natnael-Guchima [$250]
C+ Review:@parasharrajat [$1000] + [$500 Bonus]

@abekkala
Copy link
Contributor

@Natnael-Guchima and @parasharrajat offers sent!

@Natnael-Guchima
Copy link

@abekkala accepted. Thanks.

@abekkala
Copy link
Contributor

@Natnael-Guchima payment made and contract ended. Thank you! 🎉

@parasharrajat
Copy link
Member

parasharrajat commented May 23, 2023

@abekkala I don't see the offer.

@abekkala
Copy link
Contributor

@parasharrajat yes, sorry about that. It looks like Upwork has been experiencing some site issues yesterday and this morning.
I'll resend an offer and note this GH in the title.

@abekkala
Copy link
Contributor

I'll keep an eye on this. As soon as they're back up I'll resend the offer!
Screenshot 2023-05-24 at 9 18 59 AM

@abekkala
Copy link
Contributor

@parasharrajat I sent another contract it's titled [$1000] Payment for #18552 + [$500] Bonus

@parasharrajat
Copy link
Member

@abekkala Thanks. Accepted.

@abekkala
Copy link
Contributor

@parasharrajat paid and contract ended! 🎉 thank you!
Closing!

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

7 participants