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

Remove more references to get_datastore #12067

Merged
merged 2 commits into from
Feb 23, 2022
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/12067.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement experimental support for [MSC3720](https://github.com/matrix-org/matrix-doc/pull/3720) (account status endpoints).
4 changes: 2 additions & 2 deletions synapse/handlers/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class AccountHandler:
def __init__(self, hs: "HomeServer"):
self._store = hs.get_datastore()
self._main_store = hs.get_datastores().main
self._is_mine = hs.is_mine
self._federation_client = hs.get_federation_client()

Expand Down Expand Up @@ -98,7 +98,7 @@ async def _get_local_account_status(self, user_id: UserID) -> JsonDict:
"""
status = {"exists": False}

userinfo = await self._store.get_userinfo_by_id(user_id.to_string())
userinfo = await self._main_store.get_userinfo_by_id(user_id.to_string())

if userinfo is not None:
status = {
Expand Down
3 changes: 0 additions & 3 deletions synapse/rest/client/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,6 @@ class AccountStatusRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"):
super().__init__()
self._auth = hs.get_auth()
self._store = hs.get_datastore()
self._is_mine = hs.is_mine
self._federation_client = hs.get_federation_client()
self._account_handler = hs.get_account_handler()

async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
Expand Down
4 changes: 3 additions & 1 deletion tests/rest/client/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,9 @@ def test_local_user_deactivated(self):
"""Tests that the account status endpoint correctly reports a deactivated user."""
user = self.register_user("someuser", "password")
self.get_success(
self.hs.get_datastore().set_user_deactivated_status(user, deactivated=True)
self.hs.get_datastores().main.set_user_deactivated_status(
user, deactivated=True
)
)

self._test_status(
Expand Down