move guard out of is_threepid_reserved and into register.py

pull/14/head
Neil Johnson 6 years ago
parent d619b113ed
commit c99c2d58d7
  1. 2
      changelog.d/4435.bugfix
  2. 2
      synapse/config/server.py
  3. 9
      synapse/rest/client/v2_alpha/register.py

@ -1 +1 @@
Fix None guard in config.server.is_threepid_reserved
Fix None guard in calling config.server.is_threepid_reserved

@ -429,8 +429,6 @@ def is_threepid_reserved(reserved_threepids, threepid):
Returns:
boolean Is the threepid undertest reserved_user
"""
if not threepid:
return False
for tp in reserved_threepids:
if (threepid['medium'] == tp['medium'] and threepid['address'] == tp['address']):

@ -416,10 +416,11 @@ class RegisterRestServlet(RestServlet):
)
# Necessary due to auth checks prior to the threepid being
# written to the db
if is_threepid_reserved(
self.hs.config.mau_limits_reserved_threepids, threepid
):
yield self.store.upsert_monthly_active_user(registered_user_id)
if threepid:
if is_threepid_reserved(
self.hs.config.mau_limits_reserved_threepids, threepid
):
yield self.store.upsert_monthly_active_user(registered_user_id)
# remember that we've now registered that user account, and with
# what user ID (since the user may not have specified)

Loading…
Cancel
Save