Skip to content

[HOLD for payment 2023-08-01] [$1000] Dev: Web - Reaction does not work for first message of thread #22235

Closed

Description

@kbecciv

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 5, 2023
  2. melvin-bot commented on Jul 5, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jul 5, 2023

    @melvin-bot

    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
  4. dukenv0307 commented on Jul 5, 2023

    @dukenv0307
    Contributor

    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
  5. jakub-trzebiatowski commented on Jul 5, 2023

    @jakub-trzebiatowski
    Contributor

    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

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 5, 2023
  7. 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[/+] on Jul 5, 2023
  8. melvin-bot commented on Jul 5, 2023

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 5, 2023
  10. melvin-bot commented on Jul 5, 2023

    @melvin-bot

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

  11. 47 remaining items

  12. neil-marcellini commented on Aug 9, 2023

    @neil-marcellini
    Contributor

    Not overdue on my side

  13. johncschuster commented on Aug 14, 2023

    @johncschuster
    Contributor

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

  14. aimane-chnaif commented on Aug 15, 2023

    @aimane-chnaif
    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.

  15. melvin-bot commented on Aug 21, 2023

    @melvin-bot

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

  16. melvin-bot commented on Aug 22, 2023

    @melvin-bot

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

  17. melvin-bot commented on Aug 24, 2023

    @melvin-bot

    @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!

  18. melvin-bot commented on Aug 28, 2023

    @melvin-bot

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

  19. neil-marcellini commented on Aug 28, 2023

    @neil-marcellini
    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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions