add: last_online and online indicators
This commit is contained in:
parent
d3d0c41334
commit
e0a6072cc4
12 changed files with 177 additions and 9 deletions
|
@ -196,6 +196,24 @@ pub async fn update_user_role_request(
|
|||
}
|
||||
}
|
||||
|
||||
/// Update the current user's last seen value.
|
||||
pub async fn seen_request(jar: CookieJar, Extension(data): Extension<State>) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data) {
|
||||
Some(ua) => ua,
|
||||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
match data.seen_user(&user).await {
|
||||
Ok(_) => Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "User updated".to_string(),
|
||||
payload: (),
|
||||
}),
|
||||
Err(e) => Json(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Delete the given user.
|
||||
pub async fn delete_user_request(
|
||||
jar: CookieJar,
|
||||
|
|
|
@ -147,6 +147,7 @@ pub fn routes() -> Router {
|
|||
"/auth/profile/{id}/verified",
|
||||
post(auth::profile::update_user_is_verified_request),
|
||||
)
|
||||
.route("/auth/profile/me/seen", post(auth::profile::seen_request))
|
||||
.route(
|
||||
"/auth/profile/find/{id}",
|
||||
get(auth::profile::redirect_from_id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue