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-06-15] [$1000] Deleted message gets highlighted when we send a message, delete the message, visit any other chat and revisit the chat in offline mode #18165

Closed
6 tasks done
kavimuru opened this issue Apr 28, 2023 · 81 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 Apr 28, 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 the app
  2. Open any report
  3. Switch to offline mode
  4. Delete any message (currently it is not highlighted)
  5. Switch to other report and revisit the deleted message report to see that message is highlighted now
  6. Switch off offline mode
  7. Again visit the chat to see that deleted message is now gone
  8. Switch back the offline mode
  9. Revisit the chat and deleted message is back and it is still highlighted

Expected Result:

App should not highlight deleted message on revisiting chat in offline mode nor have the deleted message reappear after reconnecting online then offline

Actual Result:

App highlights deleted message on revisiting chat in offline mode and highlight remains intact. App shows deleted message in offline mode even after going back online then offline again.

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

delete.in.offline.mode.highlights.the.message.mp4
Recording.412.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682681346161399

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013afb44ff7c31e750
  • Upwork Job ID: 1654091952987746304
  • Last Price Increase: 2023-06-01
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 28, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Apr 28, 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 Overdue label May 1, 2023
@dylanexpensify
Copy link
Contributor

reviewing today!

@melvin-bot melvin-bot bot removed the Overdue label May 2, 2023
@bernhardoj
Copy link
Contributor

bernhardoj commented May 2, 2023

Proposal

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

The deleted message while offline has a hover effect after switching back from another chat.

What is the root cause of that problem?

The hover effect will show if:

  1. is hovered
  2. is a whisper
  3. a context menu active
  4. is a draft message
    style={StyleUtils.getReportActionItemStyle(
    hovered
    || isWhisper
    || this.state.isContextMenuActive
    || this.props.draftMessage,

and the condition that it meets is the third one. Why?

When we delete a chat, it will show a delete modal by calling showDeleteModal of PopoverReportActionContextMenu passing the selected report action id and the report id.

showDeleteModal(reportID, reportAction, shouldSetModalVisibility = true, onConfirm = () => {}, onCancel = () => {}) {
this.onCancelDeleteModal = onCancel;
this.onComfirmDeleteModal = onConfirm;
this.setState({
reportID,
reportAction,
shouldSetModalVisibilityForDeleteConfirmation: shouldSetModalVisibility,
isDeleteCommentConfirmModalVisible: true,
});
}

When we confirm the deletion, we

  1. delete the message
  2. hide the modal
    confirmDeleteAndHideModal() {
    this.callbackWhenDeleteModalHide = () => this.onComfirmDeleteModal = this.runAndResetCallback(this.onComfirmDeleteModal);
    Report.deleteReportComment(this.state.reportID, this.state.reportAction);
    this.setState({isDeleteCommentConfirmModalVisible: false});
    }

One thing is missing is to reset the report action id and report id. So, when we reopen the chat, it will remount the component and check, is this chat message has an active context menu?

this.state = {
isContextMenuActive: ReportActionContextMenu.isActiveReportAction(props.action.reportActionID),
};

isActiveReportAction(actionID) {
return Boolean(actionID) && this.state.reportAction.reportActionID === actionID;
}

Because we didn't clear the report action id, it will say, yes, a context menu is active for this chat message.

This issue however doesn't happen when we simply cancel the deletion because when we cancel it, we will call hideDeleteModal that will reset the report action id and along with other state.

hideDeleteModal() {
this.callbackWhenDeleteModalHide = () => this.onCancelDeleteModal = this.runAndResetCallback(this.onCancelDeleteModal);
this.setState({
reportID: '0',
reportAction: {},
isDeleteCommentConfirmModalVisible: false,
shouldSetModalVisibilityForDeleteConfirmation: true,
isArchivedRoom: false,
isChronosReport: false,
});
}

UPDATE: It's no longer true because we remove the reportActions reset here

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

Reset both report action and report id in onModalHide callback of ConfirmModal

onModalHide={this.callbackWhenDeleteModalHide}

onModalHide={() => {
    this.setState({reportID: '0', reportAction: {});
    this.callbackWhenDeleteModalHide()
}}

@dylanexpensify
Copy link
Contributor

Didn't get to this today due to focusing on ECUK and CPM tasks! Will review tomorrow!

@dylanexpensify
Copy link
Contributor

Posted about this to get clarification on expected behavior. Will update this once we come to a conclusion.

@dylanexpensify
Copy link
Contributor

After discussing we confirmed that this is an expected behavior! @dhanashree-sawant here's where you can find more info!

@dhanashree-sawant
Copy link

Hi @dylanexpensify, In the document, we have mentioned that it should be greyed out but in the issue, the deleted message gets highlighted not greyed out. It gets greyed out when we delete but when we revisit the chat, it gets highlighted.

@dylanexpensify
Copy link
Contributor

I believe that makes sense it's still highlighted while in offline mode, since technically, the delete action hasn't registered 100% yet. I think this would be a bug if we got back online, and the deleted comment did finish deletion, but then still highlighted after switching back. Mind confirming for me it doesn't do that?

@dhanashree-sawant
Copy link

Yes so on going back offline, the deleted message reappears and it is still highlighted, steps I did:

  1. switched to offline mode
  2. delete any message (currently it is not highlighted)
  3. switch to other report and revisit the deleted message report to see that message is highlighted now
  4. Switch off offline mode
  5. Again visit the chat to see that deleted message is now gone
  6. Switch back the offline mode
  7. Revisit the chat and deleted message is back and it is still highlighted

@dylanexpensify
Copy link
Contributor

And after step 5, is the message now gone? Did you show those steps in the video above?

@dhanashree-sawant
Copy link

No message still exist, sorry I haven't shown that part in the video , I will add new video below with step 6 and 7 shown in it.

@dylanexpensify
Copy link
Contributor

Ah that'd be great if you can show the steps you just commented in a video! Thanks!

@dhanashree-sawant
Copy link

Here is the video

2023-05-04.16-56-58.mp4

@bernhardoj
Copy link
Contributor

@dylanexpensify
Just sharing my thoughts.

I agree with @dhanashree-sawant that the offline feedback should be the grayed out and strikethrough-ed, but not with the highlight effect. This is consistent with other component that apply the same offline feedback, for example workspaces list. Notice there is no highlight effect.
image

Based on my finding, the chat message is highlighted because the chat message "thought" that there is an active context menu.
image

@dylanexpensify
Copy link
Contributor

@dhanashree-sawant that new video is super helpful, ty!
@bernhardoj appreciate the thoughts, and like where your head is at with it!

@dylanexpensify
Copy link
Contributor

Was able to successfully repro. Thanks for the back and forth here team!

@dylanexpensify dylanexpensify added the External Added to denote the issue can be worked on by a contributor label May 4, 2023
@melvin-bot melvin-bot bot changed the title Deleted message gets highlighted when we send a message, delete the message, visit any other chat and revisit the chat in offline mode [$1000] Deleted message gets highlighted when we send a message, delete the message, visit any other chat and revisit the chat in offline mode May 4, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 4, 2023
@melvin-bot melvin-bot bot removed the Overdue label Jun 29, 2023
@Santhosh-Sellavel
Copy link
Collaborator

Will do a checklist in a day or two, caught up with other priority items!

Regarding payment check this!

@melvin-bot melvin-bot bot added the Overdue label Jul 3, 2023
@dylanexpensify
Copy link
Contributor

@Santhosh-Sellavel let's get this done today 🙌

@melvin-bot melvin-bot bot removed the Overdue label Jul 3, 2023
@Santhosh-Sellavel
Copy link
Collaborator

@bernhardoj Could use your help here is the https://github.com/Expensify/App/pull/17348/files#r1165760995 which caused this regression?

@bernhardoj
Copy link
Contributor

@Santhosh-Sellavel yes

@melvin-bot melvin-bot bot added the Overdue label Jul 5, 2023
@dylanexpensify
Copy link
Contributor

@Santhosh-Sellavel let's get an update here today please! 🙇‍♂️

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Jul 6, 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:

@flodnv Let me know if differ on any of the above, thanks!

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Jul 6, 2023

Bug:
Deleted message highlight remains when offline, even after switching chats

Regression Steps

  1. Open a chat report on NewDot
  2. Send a message in the chat
  3. Open the context menu and choose Delete comment
  4. Cancel the delete modal
  5. Switch to another chat
  6. Come back to the chat
  7. Verify the message we are trying to delete is not highlighted
  8. Turn off internet connection
  9. Now, delete the message
  10. Repeat steps 5-7

👍 or 👎

cc: @flodnv @dylanexpensify

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@dylanexpensify
Copy link
Contributor

Reviewing today!

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@flodnv
Copy link
Contributor

flodnv commented Jul 11, 2023

This is so incredibly niche, I'm not sure it's worth adding a regression test...

@dylanexpensify
Copy link
Contributor

I think we can add it as an edge case test? They only test those once a month? But even then, maybe a bit much haha

@dylanexpensify
Copy link
Contributor

Closing!

@flodnv
Copy link
Contributor

flodnv commented Jul 12, 2023 via email

@Santhosh-Sellavel
Copy link
Collaborator

I've had not received payment for this @dylanexpensify will request via NewDot

@Santhosh-Sellavel
Copy link
Collaborator

Requested Payment on ND

@dylanexpensify
Copy link
Contributor

reopened while we wait for @Santhosh-Sellavel to be paid! Cc @anmurali

@anmurali
Copy link

Approved $1500 (with bonus) for Santhosh

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