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-11-09] [$500] A "New Messages" notification is shown when there is no new message #30359

Closed
6 tasks done
m-natarajan opened this issue Oct 25, 2023 · 41 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Oct 25, 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!


Version Number: 1.3.90-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Expensify/Expensify Issue URL:
Issue reported by: @daveSeife
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1698164387186969

Action Performed:

  1. Open any chat
  2. Have enough messages on the chat, so you are able to scroll
  3. Mark the last message as unread
  4. Start scrolling up and see that the New Messages notification appears
  5. Delete the last message
  6. Start scrolling up and Notice that New Messages notification is shown

Expected Result:

"New Messages" notification is not shown when there is no new message

Actual Result:

A "New Messages" notification is shown when there is no new message

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
XRecorder_24102023_191913.mp4
Android: mWeb Chrome
XRecorder_24102023_191754.mp4
iOS: Native
t11NewMessage.iosApp.mp4
iOS: mWeb Safari
t11NewMessage.iosSafari.mp4
MacOS: Chrome / Safari
t11NewMessage.macChrome.mp4
New.Msg.mp4
MacOS: Desktop
t11NewMessage.desktop.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013619be7f4c5f8ab1
  • Upwork Job ID: 1717212725821657088
  • Last Price Increase: 2023-10-25
@m-natarajan m-natarajan added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 25, 2023
@melvin-bot melvin-bot bot changed the title A "New Messages" notification is shown when there is no new message [$500] A "New Messages" notification is shown when there is no new message Oct 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

Job added to Upwork: https://www.upwork.com/jobs/~013619be7f4c5f8ab1

@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 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 Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

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

@s-alves10
Copy link
Contributor

s-alves10 commented Oct 25, 2023

Proposal

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

The "New Messages" notification is shown even after all the new messages are deleted

What is the root cause of that problem?

We are setting the currentUnreadMarker when reportActions or report.lastReadTime is changed

useEffect(() => {
// Iterate through the report actions and set appropriate unread marker.
// This is to avoid a warning of:
// Cannot update a component (ReportActionsList) while rendering a different component (CellRenderer).
_.each(sortedReportActions, (reportAction, index) => {
if (!shouldDisplayNewMarker(reportAction, index)) {
return;
}
if (!currentUnreadMarker && currentUnreadMarker !== reportAction.reportActionID) {
setCurrentUnreadMarker(reportAction.reportActionID);
}
});
}, [sortedReportActions, report.lastReadTime, messageManuallyMarkedUnread, shouldDisplayNewMarker, currentUnreadMarker]);

When marking a message unread, the reportActionID of the message is set to currentUnreadMarker.
When removing the message after that, we don't set null to currentUnreadMarker as you can see. So the currentUnreadMarker would have the old value even after the message is deleted

This is the root cause

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

We need to set null to currentUnreadMarker if there is no new messages
Update the above useEffect callback function

        let markerFound = false;
        _.each(sortedReportActions, (reportAction, index) => {
            if (!shouldDisplayNewMarker(reportAction, index)) {
                return;
            }
            markerFound = true;
            if (!currentUnreadMarker && currentUnreadMarker !== reportAction.reportActionID) {
                setCurrentUnreadMarker(reportAction.reportActionID);
            }
        });

        if (!markerFound) {
            setCurrentUnreadMarker(null);
        }

This works as expected

Result
30359.mp4

What alternative solutions did you explore? (Optional)

@ArekChr
Copy link
Contributor

ArekChr commented Oct 26, 2023

@s-alves10 What if another user deletes a new message when the current user has opened a report with the new message? I think this could not be handled case, but it is a very similar scenario

@s-alves10
Copy link
Contributor

then reportActions would change by pusher event and the effect callback will be called. I guess the notification message would disappear. I'll test it shortly

@s-alves10
Copy link
Contributor

@ArekChr

I just tested the case you mentioned and the 'New messages' notification disappears when the other user deletes the new message

@ArekChr
Copy link
Contributor

ArekChr commented Oct 26, 2023

Great @s-alves10! We can go with your solution.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 27, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 27, 2023
@s-alves10
Copy link
Contributor

@ArekChr

PR is ready for review #30485

@alexpensify
Copy link
Contributor

Looks like the PR is merged, waiting for automation here.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 2, 2023
@melvin-bot melvin-bot bot changed the title [$500] A "New Messages" notification is shown when there is no new message [HOLD for payment 2023-11-09] [$500] A "New Messages" notification is shown when there is no new message Nov 2, 2023
@melvin-bot melvin-bot bot added the Daily KSv2 label Nov 8, 2023
@alexpensify alexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Nov 9, 2023
Copy link

melvin-bot bot commented Nov 9, 2023

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

This comment was marked as duplicate.

@alexpensify
Copy link
Contributor

Reassigning another team member, I'm going OOO until Tuesday, November 14, and will take it back if it's still open by my return date.

@sonialiap - Required action from the team:

This payment is on hold due to regression. Can you please keep an eye out and make sure that we are making progress to address the issue and can prepare for a new payment date? Thanks!

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@madmax330
Copy link
Contributor

@s-alves10 any news?

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2023
@s-alves10
Copy link
Contributor

I don't think this causes a regression. Please check #30696 (comment)

@alexpensify
Copy link
Contributor

@sonialiap - I'm back online and will take it from here.


@madmax330 or @ArekChr - can you please confirm if you agree that this update didn't cause a regression? Also, @ArekChr please complete the checklist #30359 (comment). I want to complete the payment process this week. Thanks!

@ArekChr
Copy link
Contributor

ArekChr commented Nov 15, 2023

  • Determine if we should create a regression test for this bug. I think this green marker is important to have a regression test for this scenario:

Regression test proposal

  1. Open any chat with many messages so you can scroll them.
  2. Mark the last message as unread.
  3. Start scrolling up and see that the "New Messages" notification appears.
  4. Delete the last unread message.
  5. Verify that the "New Messages" notification disappeared after scrolling them.

Do we agree 👍 or 👎

@ArekChr
Copy link
Contributor

ArekChr commented Nov 15, 2023

I attempted to reproduce the issue mentioned, but I encountered a different problem which prevented me from doing so. Specifically, I could not delete messages due to new issues related to the action bar. @s-alves10 Did you find the root cause of 30359?

@s-alves10
Copy link
Contributor

@ArekChr

What do you mean by root cause of 30359? You mean the root cause of this issue?

@ArekChr
Copy link
Contributor

ArekChr commented Nov 15, 2023

@situchan

I'm finding the root cause of #30696. Please give me a try

@s-alves10 I regard to this message

@s-alves10
Copy link
Contributor

@ArekChr

Oh, yes. I left a comment there. Please check #30696 (comment)

@alexpensify
Copy link
Contributor

@ArekChr - to confirm, is the issue you faced due to regression from this issue or something else? I'm trying to see if we can close this issue and carry on with the payment process tomorrow. Thanks!

@ArekChr
Copy link
Contributor

ArekChr commented Nov 17, 2023

@alexpensify After looking at the @s-alves10 investigation. It looks like this issue doesn't introduce regression. We can close the issue and move forward with the payment process.

@situchan
Copy link
Contributor

Agree not regression and not affect payment but #30696 should be handled follow-up as part of this issue because that issue was raised up after merging this PR.

@alexpensify
Copy link
Contributor

Here is the payment summary:

  • External issue reporter @daveSeife $50
  • Contributor that fixed the issue @s-alves10 $500
  • Contributor+ that helped on the issue and/or PR @ArekChr paid via vendor

Upwork Job: https://www.upwork.com/jobs/~013619be7f4c5f8ab1

Extra Notes regarding payment: No bonus, the PR was created after the notification period.

@alexpensify
Copy link
Contributor

@s-alves10 - please accept in Upwork and I can complete this process. Thanks!

@s-alves10
Copy link
Contributor

@alexpensify

Offer accepted. Thanks

@alexpensify
Copy link
Contributor

Awesome! Great work, and thanks for your patience as we sorted if there was regression here. I've paid everyone in Upwork and closed the job. Now, I'm going to close this GH too.

Copy link

melvin-bot bot commented Nov 21, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 5, 2023
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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants