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-08-01] [$1000] Dev: Web - Reaction does not work for first message of thread #22235

Closed
1 of 6 tasks
kbecciv opened this issue Jul 5, 2023 · 41 comments
Closed
1 of 6 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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Jul 5, 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. Go to any chat
  2. Hover on any message and click reply in thread option
  3. In the thread, try to react on the first message

Expected Result:

Reaction should be able to be applied

Actual Result:

Reaction does not work

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.36-2 DEV
Reproducible in staging?: n/a
Reproducible in production?: n/a
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

Screen.Recording.2023-07-04.at.1.04.50.PM.mov

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019314fb87cf5420e8
  • Upwork Job ID: 1676593895120011264
  • Last Price Increase: 2023-07-05
@kbecciv kbecciv added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 5, 2023

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

@melvin-bot
Copy link

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

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jul 5, 2023

Proposal

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

Reaction does not work for first message of thread

What is the root cause of that problem?

We pass report as child report and action as parentReportAction into ReportActionItem

<ReportActionItem
report={props.report}
action={parentReportAction}
displayAsGroup={false}
isMostRecentIOUReportAction={false}
shouldDisplayNewMarker={props.shouldDisplayNewMarker}
index={0}

When we call toggleEmojiReaction, because reportID is the current report but reportActionID is parent report action, reportAction is empty, and then this function return and do nothing.

App/src/libs/actions/Report.js

Lines 1644 to 1648 in 15e547e

const reportAction = ReportActionsUtils.getReportAction(reportID, reportActionID);
if (_.isEmpty(reportAction)) {
return;
}

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

We should check if reportAction is empty that mean reportActionID is the ID of parent report action, we will get the parentReport, and get the correct reportAction.

function toggleEmojiReaction(reportID, reportActionID, emoji, paramSkinTone = preferredSkinTone) {
  let currentReportID = reportID;
  let reportAction = ReportActionsUtils.getReportAction(reportID, reportActionID);

  if (_.isEmpty(reportAction)) {
      const parentReport = ReportUtils.getParentReport(ReportUtils.getReport(reportID))
      currentReportID = parentReport.reportID;
      reportAction = ReportActionsUtils.getReportAction(currentReportID, reportActionID);
  }

  if (_.isEmpty(reportAction)) {
      return;
  }

  const message = reportAction.message[0];
  const reactionObject = message.reactions && _.find(message.reactions, (reaction) => reaction.emoji === emoji.name);
  const skinTone = emoji.types === undefined ? null : paramSkinTone; // only use skin tone if emoji supports it
  if (reactionObject) {
      if (hasAccountIDReacted(currentUserAccountID, reactionObject.users, skinTone)) {
          return removeEmojiReaction(currentReportID, reportAction, emoji, skinTone);
      }
  }
  return addEmojiReaction(currentReportID, reportAction, emoji, skinTone);
}

What alternative solutions did you explore? (Optional)

NA

Result

Screencast.from.05-07-2023.15.30.37.webm

@cubuspl42
Copy link
Contributor

cubuspl42 commented Jul 5, 2023

Proposal

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

Reacting with emoji does not work for first message in a thread.

What is the root cause of that problem?

This is a regression from #21933.

In ReportActionItemParentAction, we provide a report action from a different report than the one provided via the report property. Namely, report is the child report (the thread) and the report action (passed via action property) is from the parent report.

ReportActionItem requires the report and the report action to be related.

/** Report for this action */
report: reportPropTypes.isRequired,
/** All the data of the action item */
action: PropTypes.shape(reportActionPropTypes).isRequired,

Report for this action

In consequence, the toggleEmoji function is confused and does not work.

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

The report we provide to ReportActionItem via the report property should be the report containing the report action passed via the reportAction property, as per the ReportActionItem contract.

function ReportActionItemParentAction(props) {
    // ...
    return (
        <OfflineWithFeedback
            // ...
        >
            <View style={StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth)}>
                <View style={[styles.p5, StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]} />
                {parentReportAction && (
                    <ReportActionItem
                        // Pass the parent report
                        report={props.parentReport}
                        action={parentReportAction}
                        // ...
                        // Don't show the preview of thread replies
                        shouldDisplayThreadReplies={false}
                        // ...
                    />
                )}
            </View>
            {/* ... */}
        </OfflineWithFeedback>
    );
}

// ...

export default compose(
    withWindowDimensions,
    withLocalize,
    withOnyx({
        report: {
            key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
        },
        // Get the parent report from Onyx
        parentReport: {
            key: ({parentReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`,
        },
        parentReportActions: {
            key: ({parentReportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`,
            canEvict: false,
        },
    }),
)(ReportActionItemParentAction);

My branch

@johncschuster johncschuster added the External Added to denote the issue can be worked on by a contributor label Jul 5, 2023
@melvin-bot melvin-bot bot changed the title Dev: Web - Reaction does not work for first message of thread [$1000] Dev: Web - Reaction does not work for first message of thread Jul 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 5, 2023

Job added to Upwork: https://www.upwork.com/jobs/~019314fb87cf5420e8

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

melvin-bot bot commented Jul 5, 2023

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

@johncschuster johncschuster removed the Needs Reproduction Reproducible steps needed label Jul 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 5, 2023

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

@jeet-dhandha
Copy link
Contributor

This is a regression of above linked issue.

@jeet-dhandha
Copy link
Contributor

PR For Fix: #22270

@jeet-dhandha
Copy link
Contributor

Proposal

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

  • This was a regression of my previous issue.

What is the root cause of that problem?

  • Instead of report ID we need to access orignal reportID, which is of the parent.

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

  • We will use already existing function getOriginalReportID(reportID, action) to get the original report ID. And also change the reportActionID to the action as it was before.

What alternative solutions did you explore? (Optional)

  • N/A

@neil-marcellini
Copy link
Contributor

I would like to CME because I approved the PR that caused this regression 🙃. @aimane-chnaif I like @dukenv0307's proposal #22235 (comment).

@jeet-dhandha
Copy link
Contributor

I like to clear my wrecked code myself. So no worries my fellow frontier man @neil-marcellini.

@aimane-chnaif
Copy link
Contributor

Thanks @neil-marcellini can you please self assign on this GH?
And please check #22270 (comment).

@jeet-dhandha
Copy link
Contributor

@aimane-chnaif A question do we need to provide All videos everytime ?

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif A question do we need to provide All videos everytime ?

yes for every PR

@cubuspl42
Copy link
Contributor

As I wasn't sure if we have a formal process for it, I asked on Slack if we should proceed with proposal selection here, or should this be closed in favor of a follow-up PR by the author of the original PR which introduced a regression.

@cubuspl42
Copy link
Contributor

@neil-marcellini

I like @dukenv0307's proposal #22235 (comment).

Although I understand that that's the code that was worked on in the PR that introduced the regression, what do you think about my root cause analysis?

Is it actually correct to pass report A and a report action from report B (a different report) to ReportActionItem?

From my perspective, the essence of the issue does not lie in the toggleEmojiReaction function, which is exactly the reason why the problem was easy to overlook during the review of the original PR.

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

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 Jul 25, 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:

  • [@aimane-chnaif] The PR that introduced the bug has been identified. Link to the PR:
  • [@aimane-chnaif] 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:
  • [@aimane-chnaif] 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:
  • [@aimane-chnaif] Determine if we should create a regression test for this bug.
  • [@aimane-chnaif] 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, 2023
@johncschuster
Copy link
Contributor

Summary for payments (will be updating shortly):

External issue reporter - @gadhiyamanan - $250
Contributor that fixed the issue - @jeet-dhandha
Contributor+ that helped on the issue and/or PR - @aimane-chnaif

@aimane-chnaif
Copy link
Contributor

Regression Test Step: #19363 (comment)

@melvin-bot melvin-bot bot added the Overdue label Aug 4, 2023
@neil-marcellini
Copy link
Contributor

not overdue

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 4, 2023
@neil-marcellini
Copy link
Contributor

Bump @johncschuster

@melvin-bot melvin-bot bot removed the Overdue label Aug 7, 2023
@johncschuster
Copy link
Contributor

Thanks for the bump! I'll work on getting payment issued shortly!

@melvin-bot melvin-bot bot added the Overdue label Aug 9, 2023
@neil-marcellini
Copy link
Contributor

Not overdue on my side

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 9, 2023
@johncschuster
Copy link
Contributor

Eep! I'm sorry I let this one slip! Working on payment now!

@melvin-bot melvin-bot bot removed the Overdue label Aug 14, 2023
@aimane-chnaif
Copy link
Contributor

Here's timeline analysis:

@jeet-dhandha was not assigned on this issue, but they took responsibility of fixing this as this came from their original PR.

@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

@johncschuster, @neil-marcellini, @aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

@johncschuster, @neil-marcellini, @aimane-chnaif 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@melvin-bot
Copy link

melvin-bot bot commented Aug 24, 2023

@johncschuster, @neil-marcellini, @aimane-chnaif Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

@johncschuster, @neil-marcellini, @aimane-chnaif 12 days overdue. Walking. Toward. The. Light...

@neil-marcellini
Copy link
Contributor

Now that we have a specific issue for payment I'm going to close this.

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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

9 participants