User's own messages displaying as unread in other platforms
If you haven’t already, check out our contributing guidelines for onboarding!
Expected Result:
When a user sends a message in one platform (e.g., Desktop) using Expensify.cash, this user's own message should not show up as unread in another platform (e.g., Mobile).
Actual Result:
The user's own messages sent in one platform show up as unread in the other platform (e.g., messages sent in desktop show as unread in mobile web and vice versa).
Action Performed:
- Sign into the Expensify.Cash desktop app
- Sign into Expensify.Cash on the mobile app (or any other platform, eg: web, mobile web)
- Send a message to a user from the desktop app
- Switch to the mobile app (or whatever second platform you're using) and observe that your own message is marked as unread
- Send a message to a user from the mobile app (or whatever second platform you're using)
- Switch to the desktop app and observe that your own message is marked as unread
Workaround:
The workaround is to click into the threads to mark them as read.
Platform:
Web: Yes iOS: Yes Android: Unknown Desktop App: Yes Mobile Web: Yes
Version Number: v1.0.2-73 Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/157742
View the job on Upwork here.
Hi @marklouisdeshaun. I would like to fix this as below.
Proposal
- As we calculate the Unread message count here
https://github.com/Expensify/Expensify.cash/blob/4b914da1ca209c8ca14c55d9f6fbfe88449ef09c/src/libs/actions/Report.js#L336-L367
we have to update line 355 so that it does not update the
unreadActionCountwhen a message is from the current user. like this.
const updatedReportObject = {
reportID,
maxSequenceNumber: reportAction.sequenceNumber,
};
if (!isFromCurrentUser) {
updatedReportObject.unreadActionCount = newMaxSequenceNumber - lastReadSequenceNumber;
}
isFromCurrentUser tells us if the message is coming from the same user. newMaxSequenceNumber would be equal to the lastReadSequenceNumber on the same device as we set it optimistically but it won't be on the other devices.
I need to find some time to get myself familiar enough with this code to reasonably evaluate the solution. I will try tomorrow morning.
we have to update line 355 so that it does not update the unreadActionCount when a message is from the current user
I'm not sure that's correct. If it's from the current user then we already update the last unread to be the current sequenceNumber (which is correct so something else is happening)
https://github.com/Expensify/Expensify.cash/blob/bd8191ad56665fa8e479fc59d9cb8456ac44ffbb/src/libs/actions/Report.js#L339-L346
If we only update the unread count when the message is not from the user then surely the unread count won't change at all. That's not correct and the expectation is that the unreadCount goes to 0.
@marcaaron
So on line 339 lastReadSquenceNumber would be the last value stored on the platform.
now we do update it in setLocalLastRead to the newMaxSequenceNumber
https://github.com/Expensify/Expensify.cash/blob/4b914da1ca209c8ca14c55d9f6fbfe88449ef09c/src/libs/actions/Report.js#L300-L301
But the lastReadSquenceNumber on line 339 still refers to the old numeric value.
thus on line 355
https://github.com/Expensify/Expensify.cash/blob/4b914da1ca209c8ca14c55d9f6fbfe88449ef09c/src/libs/actions/Report.js#L355
we are using the old lastReadSquenceNumber which would result in the unread count increasing even if the message is from the current user. As lastReadSquenceNumber is not equal to the newMaxSequenceNumber.
So another possible thing would be to update the reference by calling this
const lastReadSequenceNumber = lastReadSequenceNumbers[reportID] || 0;
after this if block. https://github.com/Expensify/Expensify.cash/blob/bd8191ad56665fa8e479fc59d9cb8456ac44ffbb/src/libs/actions/Report.js#L344-L346
Let me know if I am missing something. :confused:
Sounds like the bug to me @parasharrajat! We have a stale reference to the lastReadSequenceNumber and probably just need to declare it after we update the last read. Gonna assign you here.
Hi,
This is Kaushik here. I would like to put a technical explanation for this without showing long coding strucutre,
- Check message data when send and put a condition then another user message will display as unread not own message.