anonymousland-synapse/synapse
Brendan Abolivier d73bf18d13
Server notices: Dissociate room creation/lookup from invite (#7199)
Fixes #6815

Before figuring out whether we should alert a user on MAU, we call get_notice_room_for_user to get some info on the existing server notices room for this user. This function, if the room doesn't exist, creates it and invites the user in it. This means that, if we decide later that no server notice is needed, the user gets invited in a room with no message in it. This happens at every restart of the server, since the room ID returned by get_notice_room_for_user is cached.

This PR fixes that by moving the inviting bit to a dedicated function, that's only called when the server actually needs to send a notice to the user. A potential issue with this approach is that the room that's created by get_notice_room_for_user doesn't match how that same function looks for an existing room (i.e. it creates a room that doesn't have an invite or a join for the current user in it, so it could lead to a new room being created each time a user syncs), but I'm not sure this is a problem given it's cached until the server restarts, so that function won't run very often.

It also renames get_notice_room_for_user into get_or_create_notice_room_for_user to make what it does clearer.
2020-04-04 17:27:45 +02:00
..
_scripts Replace instance variations of homeserver with correct case/spacing 2019-11-12 13:08:12 +00:00
api Convert http.HTTPStatus objects to their int equivalent (#7188) 2020-04-03 14:26:07 +01:00
app Extend web_client_location to handle absolute URLs (#7006) 2020-04-03 11:57:34 -04:00
appservice Clean up newline quote marks around the codebase (#6362) 2019-11-21 12:00:14 +00:00
config Extend web_client_location to handle absolute URLs (#7006) 2020-04-03 11:57:34 -04:00
crypto Clean up some LoggingContext stuff (#7120) 2020-03-24 14:45:33 +00:00
events Remove special auth and redaction rules for aliases events in experimental room ver. (#7037) 2020-03-09 08:58:25 -04:00
federation Move catchup of replication streams to worker. (#7024) 2020-03-25 14:54:01 +00:00
groups Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957) 2020-02-21 07:15:07 -05:00
handlers Support CAS in UI Auth flows. (#7186) 2020-04-03 15:35:05 -04:00
http Fix "'NoneType' has no attribute start|stop" logcontext errors (#7181) 2020-03-31 15:18:41 +01:00
logging Reduce the number of calls to resource.getrusage (#7183) 2020-04-03 13:21:30 +01:00
metrics Add prometheus metrics for the number of active pushers (#7103) 2020-03-19 10:00:24 +00:00
module_api Factor out complete_sso_login and expose it to the Module API 2020-03-03 10:54:44 +00:00
push Fix concurrent modification errors in pusher metrics (#7106) 2020-03-19 10:28:49 +00:00
replication Remove connections per replication stream metric. (#7195) 2020-04-01 10:40:46 +01:00
res/templates Support SAML in the user interactive authentication workflow. (#7102) 2020-04-01 08:48:00 -04:00
rest Support CAS in UI Auth flows. (#7186) 2020-04-03 15:35:05 -04:00
server_notices Server notices: Dissociate room creation/lookup from invite (#7199) 2020-04-04 17:27:45 +02:00
spam_checker_api Add type hints to the spam check module (#6915) 2020-02-14 12:49:40 -05:00
state Improve get auth chain difference algorithm. (#7095) 2020-03-18 16:46:41 +00:00
static Revert "Revert "Improve the UX of the login fallback when using SSO (#7152)"" 2020-04-03 11:28:43 +01:00
storage Merge pull request #7190 from matrix-org/rav/one_bg_update_at_a_time 2020-04-03 13:17:30 +01:00
streams Bump version of mypy 2019-12-12 15:21:12 +00:00
util Rewrite prune_old_outbound_device_pokes for efficiency (#7159) 2020-03-30 19:06:52 +01:00
__init__.py 1.12.3 2020-04-03 10:57:07 +01:00
event_auth.py Remove special auth and redaction rules for aliases events in experimental room ver. (#7037) 2020-03-09 08:58:25 -04:00
notifier.py Wake up transaction queue when remote server comes back online (#6706) 2020-01-17 10:27:19 +00:00
python_dependencies.py Fix the debian build in a better way. (#7212) 2020-04-03 10:23:36 +01:00
secrets.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
server.py Fix a bug which could cause incorrect 'cyclic dependency' error. (#7178) 2020-03-31 13:09:16 +01:00
server.pyi Remove usage of "conn_id" for presence. (#7128) 2020-03-30 16:37:24 +01:00
types.py Validate the alt_aliases property of canonical alias events (#6971) 2020-03-03 07:12:45 -05:00
visibility.py Refactor a bit 2020-03-11 18:49:41 +00:00