Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

WIP: Enable email notification on SSO when set in the config #11805

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11805.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug where email notifications were not enabled when the user logged in via an SSO even though in the config `email.notif_for_new_users` and `email.enable_notifs` were set to `true`.
12 changes: 7 additions & 5 deletions synapse/handlers/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,16 +979,18 @@ async def _register_email_threepid(
if (
self.hs.config.email.email_enable_notifs
and self.hs.config.email.email_notif_for_new_users
and token
):
# Pull the ID of the access token back out of the db
# It would really make more sense for this to be passed
# up when the access token is saved, but that's quite an
# invasive change I'd rather do separately.
user_tuple = await self.store.get_user_by_access_token(token)
# The token better still exist.
assert user_tuple
token_id = user_tuple.token_id
if token:
user_tuple = await self.store.get_user_by_access_token(token)
# The token better still exist.
assert user_tuple
token_id = user_tuple.token_id
else:
token_id = None

await self.pusher_pool.add_pusher(
user_id=user_id,
Expand Down