fix(room_member): Strip join_authorized_via_users_server (#1542) #1547
Labels
No labels
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
Wont fix
old/ci/cd
old/rust
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1547
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Partha/continuwuity:bugfix/1542-room-member-strip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Some clients were sending
join_authorized_via_users_serverwhen theywere already in the room, to change nicknames. This caused an undesirable
error, so it is simply stripped from event instead.
Fixes: #1542
Signed-off-by: Jonathan Sutton jonathansutton91@proton.me
This pull request...
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
Will formally deploy and test soon. Also, not sure if I am doing this properly
a4b6175503317dd1a8ec317dd1a8ec424abbc4a7WIP: fix(room_member): Strip join_authorized_via_users_server (#1542)to fix(room_member): Strip join_authorized_via_users_server (#1542)5c24cd8779e95709cda0e95709cda09c1c3769049c1c376904187302a608@ -377,0 +384,4 @@{let mut content: RoomMemberEventContent = membership_content.clone();content.join_authorized_via_users_server = None;*json = Raw::<AnyStateEventContent>::from_json_string(I think you can just
json.remove("join_authorized_via_users_server")rather than cloning the deserialised object and re-serializing it againI'm planning on getting rid of the extra
clone(). To be honest, if I was just going to do this, I should've just keptmut membership_content. I had been using that section as a scratchpad for testing, and left it in. It doesn't look like there is anything we can do with thejsonobject, other than to turn it into a string usingjson.json().get(). If we are going to deserialize, modify, serialize, I think using the existing deserialized object makes sense (without the extra clone), but I will 100% do it your way (or any maintainer). I'm not here to be stubborn.I'm going to continue studying, but I'm tempted to go for a raw string manipulation solution. Almost everything I've seen deserialises into a map and calls
remove()(it's just hidden from plain sight), and not really offering any performance benefit over the struct we already have. A better solution might involve manual parsing.187302a608d43fe24be67f3bd8e978bfb581423e@ -0,0 +1,34 @@use super::*;#[test]fn test_strip_room_member() -> Result<()> {This test seems a bit superfluous, you're not really testing anything.
I want to remove this before it gets pulled into main, but this is my best idea to show that a particular couple of lines do work, as intended. Otherwise, I would have to use "Just trust me", as an argument. I don't think I would find that very convincing. But yeah, definitely shouldn't get pushed to main.
b04bbb3faedd106f2185Seems OK to me. Pays the cost of an additional serialisation in this case but that's totally fine.
@ -222,3 +225,3 @@event_type: &StateEventType,state_key: &str,json: &Raw<AnyStateEventContent>,json: &mut Raw<AnyStateEventContent>,🍣
dd106f2185de74a8335e