This repository was 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
Fix application service not being able to join remote federated room without a profile set #13131
Merged
MadLittleMods
merged 2 commits into
develop
from
madlittlemods/no-profile-necessary-to-remote-join-as-as
Jul 5, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 @@ | ||
| Fix application service not being able to join remote federated room without a profile set. |
This file contains hidden or 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 | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -830,10 +830,17 @@ async def update_membership_locked( | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| content["membership"] = Membership.JOIN | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| profile = self.profile_handler | ||||||||||||||||||||||||||||
| if not content_specified: | ||||||||||||||||||||||||||||
| content["displayname"] = await profile.get_displayname(target) | ||||||||||||||||||||||||||||
| content["avatar_url"] = await profile.get_avatar_url(target) | ||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||
| profile = self.profile_handler | ||||||||||||||||||||||||||||
| if not content_specified: | ||||||||||||||||||||||||||||
| content["displayname"] = await profile.get_displayname(target) | ||||||||||||||||||||||||||||
| content["avatar_url"] = await profile.get_avatar_url(target) | ||||||||||||||||||||||||||||
| except Exception as e: | ||||||||||||||||||||||||||||
| logger.info( | ||||||||||||||||||||||||||||
| "Failed to get profile information while processing remote join for %r: %s", | ||||||||||||||||||||||||||||
| target, | ||||||||||||||||||||||||||||
| e, | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
|
Contributor
Author
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. Same pattern that we already use in synapse/synapse/handlers/message.py Lines 640 to 652 in e714b8a
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if requester.is_guest: | ||||||||||||||||||||||||||||
| content["kind"] = "guest" | ||||||||||||||||||||||||||||
|
|
@@ -910,11 +917,18 @@ async def update_membership_locked( | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| content["membership"] = Membership.KNOCK | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| profile = self.profile_handler | ||||||||||||||||||||||||||||
| if "displayname" not in content: | ||||||||||||||||||||||||||||
| content["displayname"] = await profile.get_displayname(target) | ||||||||||||||||||||||||||||
| if "avatar_url" not in content: | ||||||||||||||||||||||||||||
| content["avatar_url"] = await profile.get_avatar_url(target) | ||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||
| profile = self.profile_handler | ||||||||||||||||||||||||||||
| if "displayname" not in content: | ||||||||||||||||||||||||||||
| content["displayname"] = await profile.get_displayname(target) | ||||||||||||||||||||||||||||
| if "avatar_url" not in content: | ||||||||||||||||||||||||||||
| content["avatar_url"] = await profile.get_avatar_url(target) | ||||||||||||||||||||||||||||
| except Exception as e: | ||||||||||||||||||||||||||||
| logger.info( | ||||||||||||||||||||||||||||
| "Failed to get profile information while processing remote knock for %r: %s", | ||||||||||||||||||||||||||||
| target, | ||||||||||||||||||||||||||||
| e, | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| return await self.remote_knock( | ||||||||||||||||||||||||||||
| remote_room_hosts, room_id, target, content | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Feels like these profile functions would be better if they just returned
Nonewhen there is no profile for the local user. Profiles aren't required.synapse/synapse/handlers/profile.py
Lines 104 to 129 in e714b8a
synapse/synapse/handlers/profile.py
Lines 201 to 225 in e714b8a
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.
Yeah, I agree. Pretty much everywhere uses the same pattern as here, and we already return
Noneif the user sets and then deletes their display name