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

Have ClientReaderSlavedStore inherit RegistrationStore #5806

Merged
merged 2 commits into from
Aug 1, 2019
Merged
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/5806.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error when trying to login as a deactivated user when using a worker to handle login.
42 changes: 21 additions & 21 deletions synapse/storage/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,27 @@ def get_id_servers_user_bound(self, user_id, medium, address):
desc="get_id_servers_user_bound",
)

@cachedInlineCallbacks()
def get_user_deactivated_status(self, user_id):
"""Retrieve the value for the `deactivated` property for the provided user.

Args:
user_id (str): The ID of the user to retrieve the status for.

Returns:
defer.Deferred(bool): The requested value.
"""

res = yield self._simple_select_one_onecol(
table="users",
keyvalues={"name": user_id},
retcol="deactivated",
desc="get_user_deactivated_status",
)

# Convert the integer into a boolean.
return res == 1


class RegistrationStore(
RegistrationWorkerStore, background_updates.BackgroundUpdateStore
Expand Down Expand Up @@ -1317,24 +1338,3 @@ def set_user_deactivated_status(self, user_id, deactivated):
user_id,
deactivated,
)

@cachedInlineCallbacks()
def get_user_deactivated_status(self, user_id):
"""Retrieve the value for the `deactivated` property for the provided user.

Args:
user_id (str): The ID of the user to retrieve the status for.

Returns:
defer.Deferred(bool): The requested value.
"""

res = yield self._simple_select_one_onecol(
table="users",
keyvalues={"name": user_id},
retcol="deactivated",
desc="get_user_deactivated_status",
)

# Convert the integer into a boolean.
return res == 1