forked-synapse/synapse
Matthew Hodgson 2292dc35fc Add experimental "dont_push" push action to suppress push for notifications
This is a potential solution to https://github.com/vector-im/riot-web/issues/3374
and https://github.com/vector-im/riot-web/issues/5953
as raised by Mozilla at https://github.com/vector-im/riot-web/issues/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).
2019-09-19 00:54:05 +01:00
..
_scripts Run Black. (#5482) 2019-06-20 19:32:02 +10:00
api Ensure support users can be registered even if MAU limit is reached 2019-09-11 20:48:31 +03:00
app add report_stats_endpoint config option (#6012) 2019-09-12 11:24:57 +01:00
appservice Remove double return statements (#5962) 2019-09-03 11:42:45 +01:00
config Fix typo in account_threepid_delegates config (#6028) 2019-09-18 22:30:44 +01:00
crypto Fix well-known lookups with the federation certificate whitelist (#5997) 2019-09-14 04:58:38 +10:00
events Merge pull request #5805 from matrix-org/erikj/validate_state 2019-08-01 13:45:48 +01:00
federation Remove origin parameter from add_display_name_to_third_party_invite and add params to docstring (#6010) 2019-09-11 10:37:17 +01:00
groups Replace returnValue with return (#5736) 2019-07-23 23:00:55 +10:00
handlers v2 3PID Invites (part of MSC2140) (#5979) 2019-09-17 18:05:13 +01:00
http Fix well-known lookups with the federation certificate whitelist (#5997) 2019-09-14 04:58:38 +10:00
logging Fix logcontext spam on non-Linux platforms (#6059) 2019-09-18 21:55:37 +01:00
metrics Fix for structured logging tests stomping on logs (#6023) 2019-09-13 02:29:55 +10:00
module_api Remove unnecessary parentheses around return statements (#5931) 2019-08-30 16:28:26 +01:00
push Add opentracing span for HTTP push 2019-09-09 10:24:14 +01:00
replication Trace how long it takes for the send trasaction to complete, including retrys (#5986) 2019-09-05 17:44:55 +01:00
res/templates Allow Synapse to send registration emails + choose Synapse or an external server to handle 3pid validation (#5987) 2019-09-06 11:35:28 +01:00
rest Use the v2 Identity Service API for lookups (MSC2134 + MSC2140) (#5976) 2019-09-11 16:02:42 +01:00
server_notices Remove unnecessary parentheses around return statements (#5931) 2019-08-30 16:28:26 +01:00
state Remove double return statements (#5962) 2019-09-03 11:42:45 +01:00
static Fix SSO fallback login 2019-09-12 11:42:47 +01:00
storage Add experimental "dont_push" push action to suppress push for notifications 2019-09-19 00:54:05 +01:00
streams Remove unnecessary parentheses around return statements (#5931) 2019-08-30 16:28:26 +01:00
util Add 'failure_ts' column to 'destinations' table (#6016) 2019-09-17 11:41:54 +01:00
__init__.py 1.3.1 2019-08-17 09:16:17 +01:00
event_auth.py Cleanup event auth type initialisation (#5975) 2019-09-04 16:16:56 +01:00
notifier.py Remove unnecessary parentheses around return statements (#5931) 2019-08-30 16:28:26 +01:00
python_dependencies.py Fix for structured logging tests stomping on logs (#6023) 2019-09-13 02:29:55 +10:00
secrets.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
server.py Allow use of different ratelimits for admin redactions. 2019-09-11 10:46:38 +01:00
server.pyi Run Black. (#5482) 2019-06-20 19:32:02 +10:00
types.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
visibility.py Replace returnValue with return (#5736) 2019-07-23 23:00:55 +10:00