-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add experimental "dont_push" push action to suppress push for notifications #6061
Conversation
…ations This is a potential solution to https://github.com/vector-im/riot-web/issues/3374 and element-hq/element-web#5953 as raised by Mozilla at element-hq/element-web#10868. This lets you define a push rule action which increases the badge count (unread notification) count on a given room, but doesn't actually send a push for that notification via email or HTTP. We might want to define this as the default behaviour for group chats in future to solve https://github.com/vector-im/riot-web/issues/3268 at last. This is implemented as a string action rather than a tweak because: * Other pushers don't care about the tweak, given they won't ever get pushed * The DB can store the tweak more efficiently using the existing `notify` table. * It avoids breaking the default_notif/highlight_action optimisations. Clients which generate their own notifs (e.g. desktop notifs from Riot/Web would need to be aware of the new push action) to uphold it. An alternative way to do this would be to maintain a `msg_count` alongside `highlight_count` and `notification_count` in `unread_notifications` in sync responses. However, doing this by counting the rows in `events` since the `stream_position` of the user's last read receipt turns out to be painfully slow (~200ms), perhaps due to the size of the events table. So instead, we use the highly optimised existing event_push_actions (and event_push_actions_staging) table to maintain the counts - using the code paths which already exist for tracking unread notification counts efficiently. These queries are typically ~3ms or so. The biggest issues I see here are: * We're slightly repurposing the `notif` field on `event_push_actions` to track whether a given action actually sent a `push` or not. This doesn't seem unreasonable, but it's slightly naughty given that previously the field explicitly tracked whether `notify` was true for the action (and as a result, it was uselessly always set to 1 in the DB). * We're going to put more load on the `event_push_actions` table for all the random group chats which people had previously muted. In practice i don't think there are many of these though. * There isn't an MSC for this yet (although this comment could become one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than that, I think this seems reasonable.
@@ -223,6 +223,7 @@ def get_after_receipt(txn): | |||
" AND ep.user_id = ?" | |||
" AND ep.stream_ordering > ?" | |||
" AND ep.stream_ordering <= ?" | |||
" AND ep.notif = 1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably more erik's territory but just to note that this might need some care to make sure the db does a sensible thing as this table is generally massive.
Could the notification here, rather than incrementing the notification count, increment a named counter? Benefits:
|
Having spoken this through with @erikjohnston, conclusions are:
Separately, I'm trying to figure out really what the UX should be for badges in Riot in general, and whether this is really going to help that much. |
this doesn't seem to be going anywhere, so I'm going to close it for now at least. |
for reference, this got replaced by msc2625 and element-hq/element-web#7673, which themselves later got backed out and replaced. |
This is a potential solution to https://github.com/vector-im/riot-web/issues/3374
and element-hq/element-web#5953
as raised by Mozilla at element-hq/element-web#10868.
This lets you define a push rule action which increases the badge count (unread notification)
count on a given room, but doesn't actually send a push for that notification via email or HTTP.
We might want to define this as the default behaviour for group chats in future
to solve https://github.com/vector-im/riot-web/issues/3268 at last.
This is implemented as a string action rather than a tweak because:
notify
column.Clients which generate their own notifs (e.g. desktop notifs from Riot/Web
would need to be aware of the new push action) to uphold it.
An alternative way to do this would be to maintain a
msg_count
alongsidehighlight_count
andnotification_count
inunread_notifications
in sync responses.However, doing this by counting the rows in
events
since thestream_position
of the user's last read receipt turns out to be painfully slow (~200ms), perhaps
due to the size of the events table. So instead, we use the highly optimised
existing event_push_actions (and event_push_actions_staging) table to maintain
the counts - using the code paths which already exist for tracking unread
notification counts efficiently. These queries are typically ~3ms or so.
The biggest issues I see here are:
notif
field onevent_push_actions
totrack whether a given action actually sent a
push
or not. This doesn'tseem unreasonable, but it's slightly naughty given that previously the
field explicitly tracked whether
notify
was true for the action (andas a result, it was uselessly always set to 1 in the DB).
event_push_actions
table for all therandom group chats which people had previously muted. In practice i don't
think there are many of these though.