- Ya
- 13 Agosti 2026, 02:36 UTC
- Mwandishi
- Kamo
- Ahadi ya
- 97e9c76
Unread has always been derived from the viewer's own MediaSessionMember row, so a conversation they had not joined produced no count at all. On a support queue that is most of it — 27 of the 37 live tickets are unassigned, and 26 of those have exactly one session member, the person who asked for help. Those are precisely the rows that most need flagging, and they were the ones that structurally could not carry a flag: nobody had joined them, so there was no reader for them to be unread by. countUnseenBySessionForViewer answers the question a queue asks instead. The LEFT JOIN onto membership is the whole trick: with no membership row there is no read pointer, so every inbound message counts, which is the truth — the viewer has seen none of them. One query per page, matching how the visitor rows beside it are already bulk-loaded. System events are excluded. A status change or a reassignment is bookkeeping about the conversation, and counting it lights up rows where nobody has actually said anything — worse than no badge at all on a screen whose job is deciding what needs a reply. SupportTicketDTO.unseenCount is populated on the list and detail reads and left null everywhere else, because "unseen" is a fact about a viewer and a number invented for a caller who did not ask about one would simply be wrong.