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 /send_relation endpoint. #11682
Merged
Merged
Changes from all commits
Commits
Show all changes
3 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 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 unstable `/send_relation` endpoint. |
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 |
---|---|---|
|
@@ -93,11 +93,6 @@ def test_send_relation(self): | |
channel.json_body, | ||
) | ||
|
||
def test_deny_membership(self): | ||
"""Test that we deny relations on membership events""" | ||
channel = self._send_relation(RelationTypes.ANNOTATION, EventTypes.Member) | ||
self.assertEquals(400, channel.code, channel.json_body) | ||
|
||
def test_deny_invalid_event(self): | ||
"""Test that we deny relations on non-existant events""" | ||
channel = self._send_relation( | ||
|
@@ -1119,7 +1114,8 @@ def _send_relation( | |
relation_type: One of `RelationTypes` | ||
event_type: The type of the event to create | ||
key: The aggregation key used for m.annotation relation type. | ||
content: The content of the created event. | ||
content: The content of the created event. Will be modified to configure | ||
the m.relates_to key based on the other provided parameters. | ||
access_token: The access token used to send the relation, defaults | ||
to `self.user_token` | ||
parent_id: The event_id this relation relates to. If None, then self.parent_id | ||
|
@@ -1130,17 +1126,21 @@ def _send_relation( | |
if not access_token: | ||
access_token = self.user_token | ||
|
||
query = "" | ||
if key: | ||
query = "?key=" + urllib.parse.quote_plus(key.encode("utf-8")) | ||
|
||
original_id = parent_id if parent_id else self.parent_id | ||
|
||
if content is None: | ||
content = {} | ||
content["m.relates_to"] = { | ||
"event_id": original_id, | ||
"rel_type": relation_type, | ||
} | ||
if key is not None: | ||
content["m.relates_to"]["key"] = key | ||
Comment on lines
+1131
to
+1138
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. This pretty much inlines the logic from |
||
|
||
channel = self.make_request( | ||
"POST", | ||
"/_matrix/client/unstable/rooms/%s/send_relation/%s/%s/%s%s" | ||
% (self.room, original_id, relation_type, event_type, query), | ||
content or {}, | ||
f"/_matrix/client/v3/rooms/{self.room}/send/{event_type}", | ||
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.
|
||
content, | ||
access_token=access_token, | ||
) | ||
return channel | ||
|
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.
As far as I can tell there's not need to test this specifically?
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.
Not quite sure how to confirm that, but the linked MSC didn't have the word "member" or "membership" in it anywhere.
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.
I'm not quite sure either. MSC2677 also doesn't have any mention...
Anyway, I removed this because the client-server API won't let you make a membership event directly anyway, so I don't see why this is an issue!