"N unreads" banner on "All messages", but no unreads in home view
#3,589 opened on Aug 14, 2019
Repository metrics
- Stars
- (1,348 stars)
- PR merge metrics
- (PR metrics pending)
Description
Originally reported in chat: https://chat.zulip.org/#narrow/stream/48-mobile/topic/all.20messages.20and.20unread.20messages/near/779399
Screenshots there show
- the app's home tab with "No unread messages", and no counters on PMs or mentions etc.
- the "All messages" screen, with a "4 unread messages" banner. None of the messages in view have a green unread-marker.
So there's a mismatch between two different presentations of whether there are unreads.
This is a bit like #3549. There:
- the green marker clears (not clear if that's happening or not in this case)
- but the "unread messages" banner at the top sticks around
- ... but in that issue, the message remains in the home view!
In that issue, I wrote:
we have two conflicting ideas of whether each message is read, causing us to show the inconsistencies Rishi described. The Redux store controls the home view and the "1 unread message" banner, and the data inside the webview controls the unread marker. I believe the unread flag in the Redux store only gets cleared when we hear back from the server.
But the inconsistency seen in this issue is between those two things that are controlled by the Redux store.
Some hypotheses on where the bug could be:
-
There are a couple of different spots in the Redux store that have relevant information -- I think the banner is based on the per-message
readflags understate.flags.read, while the home view is based on some summary data structures instate.unread. So if there's a bug where the reducers managing those two subtrees of the state get the data out of sync, that could cause these symptoms. -
It could also be that that code is working perfectly fine and that data is staying in sync, and there's an issue elsewhere. For example, maybe the "All messages" view includes some messages that don't appear in the home screen's unreads. Possible hypotheses for that include: muted topics? muted streams? @-mentions? alert words?
Probably we ought to have an invariant that the messages that count for the unreads list in the home view are exactly the same as the messages that show up in "All messages". But I'd have to dig into the code to be confident about whether we do have such an invariant.
Possibly also related to #3509. It's not clear in that issue whether the home tab with its unreads list is in sync with the "N unreads" banner.