pub fn notification_count(
conn: &Connection,
room: &Room,
user_id: i64,
) -> Result<i64, MatrixStoreError>Expand description
unread_notifications.notification_count for user_id in room (plan
§3.5): the count of message-like timeline events (see
[NOTIFICATION_MESSAGE_TYPES_SQL]) strictly after the FURTHER-AHEAD of
the caller’s own m.read/m.read.private receipt — resolved by the
target events’ own stream_id (timeline position), never by a receipt
row’s own stream_id column (a different axis — see upsert_receipt’s
own doc) — and bounded above by visible_upper_bound (a leave/
ban’d member’s count never includes anything past their own
departure). Excludes the caller’s own sends (nobody is notified about
their own message) and, being restricted to
[NOTIFICATION_MESSAGE_TYPES_SQL], every state event and m.reaction.
Not a member of the room at all (HistoryWindow::Nothing) is always
0 — there is nothing this caller could be notified about.
highlight_count is always 0 from this server (plan §3.5: no push-
rule/keyword-highlight engine in v1, encrypted or not) — that is a
constant the /sync response builder (P10) sets directly, not a second
query here.