MSC4426 : support set/clear/fetch own user status #6703
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6703 +/- ##
=======================================
Coverage ? 89.94%
=======================================
Files ? 397
Lines ? 110671
Branches ? 110671
=======================================
Hits ? 99544
Misses ? 7357
Partials ? 3770 ☔ View full report in Codecov by Harness. |
a88cd1f to
13a78e0
Compare
Hywan
left a comment
There was a problem hiding this comment.
Great! Thanks for the contribution. I left a couple of question regarding data validation client-side, I think it could be a nice addition to save calls to the server.
| /// # Arguments | ||
| /// | ||
| /// * `emoji` - the status emoji. The MSC limits this to 32 bytes; not | ||
| /// enforced client-side. |
There was a problem hiding this comment.
Why “not enforced client-side”? It would save one roundtrip to the server.
There was a problem hiding this comment.
The conversation on Ruma for reference ruma/ruma#2498 (comment). (Not saying that answers what we should do in the SDK, just noting that that's why Ruma doesn't do any checks on this)
There was a problem hiding this comment.
I see. However, since the Rust SDK tries to be strict and consistent regarding the specification, I prefer to have a check here.
There was a problem hiding this comment.
What kind of error should I return then? Can you point me to any parameter validation in the code base, because I fail to see one...
There was a problem hiding this comment.
@Hywan this is blocking us, do you think we can move without it?
| /// * `text` - the status text. The MSC limits this to 256 bytes; not | ||
| /// enforced client-side. |
There was a problem hiding this comment.
Same question: why “not enforced client-side”? Same reason.
| let client = server.client_builder().server_versions(vec![MatrixVersion::V1_16]).build().await; | ||
| let user_id = client.user_id().unwrap(); | ||
|
|
||
| // Two PUTs expected: one with a join ts, one without. |
There was a problem hiding this comment.
Would be great to test the payload then.
Adds support for MSC4426 (user status profile fields). Two new profile fields are exposed end-to-end behind a new
unstable-msc4426.m.status: user-set emoji + text.m.call: call indicator with an optionalcall_joined_ts.SDK: four new methods on
Account:set_status/clear_status/set_call/clear_callFFI : two uniffi records
UserStatus { emoji, text }andUserCall { call_joined_ts }Client::set_user_status(UserStatus): writesm.status.Client::clear_user_status(): concurrently clears bothm.statusandm.call(the latter prevents the call indicator from reappearing immediately after a manual clear).Client::get_profile(user_id)now returnsstatus: Option<UserStatus>andcall: Option<UserCall>alongside the existing fields.The FFI keeps the precedence rule (m.status over m.call) out of the API.
Handles part of #6616.
Signed-off-by: