-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to filter by state event type on admin room state endpoint #18035
base: develop
Are you sure you want to change the base?
Conversation
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.
LGTM, thanks!
tests/rest/admin/test_room.py
Outdated
room_id = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok) | ||
|
||
channel = self.make_request( | ||
"GET", | ||
f"/_synapse/admin/v1/rooms/{room_id}/state?type=m.something.else", | ||
f"/_synapse/admin/v1/rooms/{room_id}/state?type=''", |
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 think this would just be:
f"/_synapse/admin/v1/rooms/{room_id}/state?type=''", | |
f"/_synapse/admin/v1/rooms/{room_id}/state?type=", |
else you'll end up with type = "''"
.
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.
Turns out if you do ?type=
, then you indeed end up with type = ""
.
Of course, then we end up ignoring type
altogether due do the if type
, which is falsy for an empty string.
So all state is returned, and test_room_state_param_empty
fails.
I think this behaviour makes sense (ignore if empty string) rather than having no results returned. You can't have an empty type for an event, so this is an invalid parameter value.
If you agree, could you update the test to say that 5
results should have been returned, such that it passes?
25c0726
to
46d5240
Compare
Adds a query param
type
to/_synapse/admin/v1/rooms/{room_id}/state
that filters the state event query by state event type.