Skip to content

[HOLD for payment 2023-08-01] [$1000] The emoji picker does not close when UserA deletes the message that UserB is in the process of editing #22214

Closed

Description

@kavimuru

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. Login with userA’s account
  2. Go to the “New room” section
  3. Enter room name and select userA workspace
  4. Select visibility to “Public”
  5. Click on “Create room”
  6. Go to the room details
  7. Share code > Copy URL to clipboard

  8. Open other browser and login with userB’s account
  9. Join the room by pasting room URL

  10. Send a message in room from userB
  11. Click on “Edit comment” message after sent
  12. Open emoji picker
  13. Switch back to UserA's account and delete the message sent by UserB

Expected Result:

The emoji picker should close when UserA deletes the message that UserB is editing

Actual Result:

The emoji picker does not close when UserA deletes the message that UserB is in the process of editing

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.36-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

screen-recording-2023-07-04-at-14632-am_myoJRuwR.mp4
Recording.1160.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0160c5dd36cad866e5
  • Upwork Job ID: 1678374584595656704
  • Last Price Increase: 2023-07-10

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on Jul 4, 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. samh-nl commented on Jul 4, 2023

    @samh-nl
    Contributor

    Proposal

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

    The emoji picker remains open when UserA deletes the message that UserB is editing

    What is the root cause of that problem?

    The emoji picker should close if the message has been deleted or for a different reason is no longer in edit mode, for example if edit mode was exited via a different tab/window (same account)

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

    In the ReportActionItemMessageEdit component, an unmount should be detected and this should call hideEmojiPicker() (EmojiPickerAction.js), but only if the emoji picker actually belongs to this message, which can be checked using the isActiveReportAction method (EmojiPickerAction.js)

    useEffect(() => {
    	return () => {
    		if (isActiveReportAction(props.action.reportActionID)) {
    			hideEmojiPicker();
    		}
    	};
    });

    To correctly identify the initiating reportAction for the emoji picker (which is currently not stored), we must pass the reportAction. This will prevent the emoji picker from being closed if it's initiated elsewhere, for example the new message composer or via editing a different message.

    To accomplish this, the reportAction prop should be created and props.action should be passed in EmojiPickerButton:

    <EmojiPickerButton
    isDisabled={props.shouldDisableEmojiPicker}
    onModalHide={() => InteractionManager.runAfterInteractions(() => textInputRef.current.focus())}
    onEmojiSelected={addEmojiToTextBox}
    nativeID={emojiButtonID}
    />

    Next, the reportAction prop should be passed in the EmojiPickerAction.showEmojiPicker call:

    onPress={() => EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor)}

    What alternative solutions did you explore? (Optional)

    N/A

  5. hoangzinh commented on Jul 7, 2023

    @hoangzinh
    Contributor

    Proposal

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

    The emoji picker does not close when UserA deletes the message that UserB is in the process of editing

    What is the root cause of that problem?

    In the ReportActionItem component, we already have logic so that when a report action item is unmounted (or removed), it will hide the EmojiPicker if this condition EmojiPickerAction.isActiveReportAction(props.action.reportActionID) is true (line 123)

    useEffect(
    () => () => {
    // ReportActionContextMenu and EmojiPicker are global component,
    // we use showContextMenu and showEmojiPicker to show them,
    // so we should also hide them when the current component is destroyed
    if (ReportActionContextMenu.isActiveReportAction(props.action.reportActionID)) {
    ReportActionContextMenu.hideContextMenu();
    ReportActionContextMenu.hideDeleteModal();
    }
    if (EmojiPickerAction.isActiveReportAction(props.action.reportActionID)) {
    EmojiPickerAction.hideEmojiPicker(true);
    }
    },
    [props.action.reportActionID],
    );

    It works well if we open EmojiPicker by clicking on either the context menu or the report item reactions menu. But when we click on the Emoji button in the right hand of edit message composer, it won't work because we haven't passed the reportAction when click on that emoji button yet
    onPress={() => EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor)}

    Thus, we can't store the current reportAction in this case => It leads to above condition returns false => it won't work properly.

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

    The EmojiPickerButton component originally used in the main composer, but we would like to use it in the edit composer as well. So I think we need to update it a little bit in this case.

    More details, we should apply what we did regarding showing EmojiPicker in the MiniQuickEmojiReactions component for EmojiPickerButton component, that means:

  6. anmurali commented on Jul 7, 2023

    @anmurali

    I am not sure how user A can delete user B's message in a room. I don't see that option at all.
    image

  7. hoangzinh commented on Jul 8, 2023

    @hoangzinh
    Contributor

    @anmurali user A must be an admin for that room. Or user B is logging in another device, delete his message.

  8. anmurali commented on Jul 10, 2023

    @anmurali

    Ah gotcha!

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 10, 2023
  10. 45 remaining items

  11. anmurali commented on Aug 15, 2023

    @anmurali
  12. ayazhussain79 commented on Aug 15, 2023

    @ayazhussain79
    Contributor

    @anmurali offer accepted, Thank you

  13. allroundexperts commented on Aug 15, 2023

    @allroundexperts
    Contributor

    Requested the ND payment.

  14. JmillsExpensify commented on Aug 15, 2023

    @JmillsExpensify
    Contributor

    Reviewed the details for @allroundexperts. Approved for payment in NewDot based on the BZ summary above.

  15. melvin-bot commented on Aug 21, 2023

    @melvin-bot

    @hoangzinh, @anmurali, @allroundexperts, @marcaaron Huh... This is 4 days overdue. Who can take care of this?

  16. melvin-bot commented on Aug 21, 2023

    @melvin-bot

    @hoangzinh, @anmurali, @allroundexperts, @marcaaron Eep! 4 days overdue now. Issues have feelings too...

  17. marcaaron commented on Aug 22, 2023

    @marcaaron
    Contributor

    Anything left to do for this one?

  18. hoangzinh commented on Aug 23, 2023

    @hoangzinh
    Contributor

    @marcaaron Nope, I think we can close this issue.

  19. marcaaron commented on Aug 24, 2023

    @marcaaron
    Contributor

    Thanks !

  20. ayazhussain79 commented on Oct 23, 2023

    @ayazhussain79
    Contributor

    @anmurali Could you please end the contract of this bug job on upwork

  21. ayazhussain79 commented on Oct 26, 2023

    @ayazhussain79
    Contributor

    @anmurali Kindly close the job on Upwork, it's still in progress

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 contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions