This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Remove the deprecated Handlers object #8494
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
78d5f91
Move the identity handler to the HomeServer.
clokep 2c438d0
Move the search handler to the HomeServer.
clokep df7c7b0
Move the directory handler to the HomeServer.
clokep 7e27a69
Move the admin handler to HomeServer.
clokep bdf8b76
Move the federation handler to HomeServer.
clokep ef0963b
Remove the Handlers object.
clokep 9f77a8d
Clean-up some test code.
clokep 2ca66f8
Add a changelog.
clokep 7000b5a
Fix tests.
clokep 1394486
Merge remote-tracking branch 'origin/develop' into clokep/handlers-cl…
clokep 6876a62
Ensure the directory handler is loaded.
clokep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Remove the deprecated `Handlers` object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ def __init__(self, hs): | |
self.hs = hs | ||
self.store = hs.get_datastore() | ||
self.auth = hs.get_auth() | ||
self.admin_handler = hs.get_handlers().admin_handler | ||
self.admin_handler = hs.get_admin_handler() | ||
|
||
async def on_GET(self, request, user_id): | ||
target_user = UserID.from_string(user_id) | ||
|
@@ -82,7 +82,7 @@ def __init__(self, hs): | |
self.hs = hs | ||
self.store = hs.get_datastore() | ||
self.auth = hs.get_auth() | ||
self.admin_handler = hs.get_handlers().admin_handler | ||
self.admin_handler = hs.get_admin_handler() | ||
|
||
async def on_GET(self, request): | ||
await assert_requester_is_admin(self.auth, request) | ||
|
@@ -135,7 +135,7 @@ class UserRestServletV2(RestServlet): | |
def __init__(self, hs): | ||
self.hs = hs | ||
self.auth = hs.get_auth() | ||
self.admin_handler = hs.get_handlers().admin_handler | ||
self.admin_handler = hs.get_admin_handler() | ||
self.store = hs.get_datastore() | ||
self.auth_handler = hs.get_auth_handler() | ||
self.profile_handler = hs.get_profile_handler() | ||
|
@@ -448,7 +448,7 @@ class WhoisRestServlet(RestServlet): | |
def __init__(self, hs): | ||
self.hs = hs | ||
self.auth = hs.get_auth() | ||
self.handlers = hs.get_handlers() | ||
self.admin_handler = hs.get_admin_handler() | ||
|
||
async def on_GET(self, request, user_id): | ||
target_user = UserID.from_string(user_id) | ||
|
@@ -461,7 +461,7 @@ async def on_GET(self, request, user_id): | |
if not self.hs.is_mine(target_user): | ||
raise SynapseError(400, "Can only whois a local user") | ||
|
||
ret = await self.handlers.admin_handler.get_whois(target_user) | ||
ret = await self.admin_handler.get_whois(target_user) | ||
|
||
return 200, ret | ||
|
||
|
@@ -591,7 +591,6 @@ def __init__(self, hs): | |
self.hs = hs | ||
self.store = hs.get_datastore() | ||
self.auth = hs.get_auth() | ||
self.handlers = hs.get_handlers() | ||
|
||
async def on_GET(self, request, target_user_id): | ||
"""Get request to search user table for specific users according to | ||
|
@@ -612,7 +611,7 @@ async def on_GET(self, request, target_user_id): | |
term = parse_string(request, "term", required=True) | ||
logger.info("term: %s ", term) | ||
|
||
ret = await self.handlers.store.search_users(term) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this code was just broken... |
||
ret = await self.store.search_users(term) | ||
return 200, ret | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary because previously
get_handlers()
would instantiate the directory handler (and a few other handlers). Only the directory handler calledregister_edu_handler
orregister_query_handler
.