refactor: Fix errors in api/client/presence.rs

This commit is contained in:
Ginger
2026-04-28 09:16:52 -04:00
parent 83902a584b
commit 69d33931fa
+7 -6
View File
@@ -2,7 +2,10 @@ use std::time::Duration;
use axum::extract::State; use axum::extract::State;
use conduwuit::{Err, Result}; use conduwuit::{Err, Result};
use ruma::api::client::presence::{get_presence, set_presence}; use ruma::{
api::client::presence::{get_presence, set_presence},
assign,
};
use crate::Ruma; use crate::Ruma;
@@ -26,7 +29,7 @@ pub(crate) async fn set_presence_route(
.set_presence(body.sender_user(), &body.presence, None, None, body.status_msg.clone()) .set_presence(body.sender_user(), &body.presence, None, None, body.status_msg.clone())
.await?; .await?;
Ok(set_presence::v3::Response {}) Ok(set_presence::v3::Response::new())
} }
/// # `GET /_matrix/client/r0/presence/{userId}/status` /// # `GET /_matrix/client/r0/presence/{userId}/status`
@@ -76,13 +79,11 @@ pub(crate) async fn get_presence_route(
.map(|millis| Duration::from_millis(millis.into())), .map(|millis| Duration::from_millis(millis.into())),
}; };
Ok(get_presence::v3::Response { Ok(assign!(get_presence::v3::Response::new(presence.content.presence), {
// TODO: Should ruma just use the presenceeventcontent type here?
status_msg, status_msg,
currently_active: presence.content.currently_active, currently_active: presence.content.currently_active,
last_active_ago, last_active_ago,
presence: presence.content.presence, }))
})
}, },
| _ => Err!(Request(NotFound("Presence state for this user was not found"))), | _ => Err!(Request(NotFound("Presence state for this user was not found"))),
} }