add harmless check for presence PUT matching sender user
this is already done but we just don't error and always use the sender user. match synapse behaviour where we check and error. Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
b13ea4ff45
commit
405167fc3f
1 changed files with 8 additions and 0 deletions
|
@ -16,6 +16,14 @@ pub(crate) async fn set_presence_route(body: Ruma<set_presence::v3::Request>) ->
|
|||
}
|
||||
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
if sender_user != &body.user_id && body.appservice_info.is_none() {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::InvalidParam,
|
||||
"Not allowed to set presence of other users",
|
||||
));
|
||||
}
|
||||
|
||||
services()
|
||||
.presence
|
||||
.set_presence(sender_user, &body.presence, None, None, body.status_msg.clone())?;
|
||||
|
|
Loading…
Add table
Reference in a new issue