You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$1000] Chat is not marked as read when receiving messages while in the report #23733
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: v1.3.46-0 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 Expensify/Expensify Issue URL: Issue reported by:@hannojg Slack conversation:
changed the title [-]Chat is not marked as read when receiving messages while in the report[/-][+][$1000] Chat is not marked as read when receiving messages while in the report[/+]on Jul 27, 2023
Note: I was able to reproduce this issue on Web too, so it was not only on mobile.See below video.
Screen.Recording.2023-07-27.at.23.43.52.mov
Please re-state the problem that we are trying to solve in this issue.
When a user has a report opened and a new message is received, the message is not marked as read.
What is the root cause of that problem?
The RC of this issue is the following function showReportActionNotification logic as it is the entrypoint of any newly received message in a report. Whenever a new message is received, this function is triggered and it calculates if a notification should be shown to the user for that message or not using the shouldShowReportActionNotification method which acts as a guard clause.
Further down we can see the call to the method notifyNewAction , which executes the callback here which is responsible for performing certain actions including marking the message as read here.
If the guard clause mentioned above prevents the notification to be sent to the user, the function returns and notifyNewAction method is never called which in turn never calls the callback responsible for marking the message as read and is also the single source of truth for the "new action" event.
It can be seen here in shouldShowReportActionNotification that it returns false if a user is currently viewing the report which activates the guard clause and the message is never marked as read.
What changes do you think we should make in order to solve the problem?
The call to the notifyNewAction method should be placed before the guard clause such that it is always executed irrespective of that a notification should be sent to the user or not.The updated code should look like this:
function showReportActionNotification(reportID, action) {
notifyNewAction(reportID, action.actorAccountID, action.reportActionID);
if (!shouldShowReportActionNotification(reportID, action)) {
return;
}
Log.info('[LocalNotification] Creating notification');
LocalNotification.showCommentNotification({
report: allReports[reportID],
reportAction: action,
onClick: () => {
// Navigate to this report onClick
Navigation.navigate(ROUTES.getReportRoute(reportID));
},
});
}
What alternative solutions did you explore? (Optional)
@Talha345 can you test again on latest main? I am also not able to reproduce.
Please explain in root cause why this is sometimes reproducible but sometimes not?
@Talha345 can you test again on latest main? I am also not able to reproduce.
Please explain in root cause why this is sometimes reproducible but sometimes not?
@situchan I am no longer able to reproduce this on either platform in dev on latest main but I am still able to reproduce it on STG.Lets wait a day or two and we can test again on STG to see if the issue is no longer present.
Activity
melvin-bot commentedon Jul 27, 2023
Triggered auto assignment to @sonialiap (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 27, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)[-]Chat is not marked as read when receiving messages while in the report[/-][+][$1000] Chat is not marked as read when receiving messages while in the report[/+]melvin-bot commentedon Jul 27, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01fb57ede1a93ebb92
melvin-bot commentedon Jul 27, 2023
Current assignee @sonialiap is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Jul 27, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (
External)mountiny commentedon Jul 27, 2023
Follow up to #23729
Talha345 commentedon Jul 27, 2023
Proposal
Note: I was able to reproduce this issue on Web too, so it was not only on mobile.See below video.
Screen.Recording.2023-07-27.at.23.43.52.mov
Please re-state the problem that we are trying to solve in this issue.
When a user has a report opened and a new message is received, the message is not marked as read.
What is the root cause of that problem?
The RC of this issue is the following function showReportActionNotification logic as it is the entrypoint of any newly received message in a report. Whenever a new message is received, this function is triggered and it calculates if a notification should be shown to the user for that message or not using the
shouldShowReportActionNotificationmethod which acts as a guard clause.Further down we can see the call to the method
notifyNewAction, which executes the callback here which is responsible for performing certain actions including marking the message as read here.If the guard clause mentioned above prevents the notification to be sent to the user, the function returns and
notifyNewActionmethod is never called which in turn never calls the callback responsible for marking the message as read and is also the single source of truth for the "new action" event.It can be seen here in
shouldShowReportActionNotificationthat it returns false if a user is currently viewing the report which activates the guard clause and the message is never marked as read.What changes do you think we should make in order to solve the problem?
The call to the
notifyNewActionmethod should be placed before the guard clause such that it is always executed irrespective of that a notification should be sent to the user or not.The updated code should look like this:What alternative solutions did you explore? (Optional)
N/A
hannojg commentedon Jul 28, 2023
@Talha345 Can you please check if you are still able to reproduce on web, when having the changes from these PR in your branch:
I believe you haven't. I think when making the proposal its important to be up to date with the latest state of the branch.
42 remaining items
melvin-bot commentedon Aug 21, 2023
@sonialiap, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
situchan commentedon Aug 21, 2023
@Talha345 can you test again on latest main? I am also not able to reproduce.
Please explain in root cause why this is sometimes reproducible but sometimes not?
unread.mov
Talha345 commentedon Aug 21, 2023
@situchan Okay,I will update in a few hours.
Talha345 commentedon Aug 21, 2023
@situchan I am no longer able to reproduce this on either platform in dev on latest main but I am still able to reproduce it on STG.Lets wait a day or two and we can test again on STG to see if the issue is no longer present.
melvin-bot commentedon Aug 24, 2023
@sonialiap @situchan this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks!
melvin-bot commentedon Aug 24, 2023
Current assignee @situchan is eligible for the Internal assigner, not assigning anyone new.
melvin-bot commentedon Aug 25, 2023
@sonialiap, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!
sonialiap commentedon Aug 28, 2023
I cannot reproduce on staging or production either. Seems like the issue is resolved
Please reopen if the issue shows up again