mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 05:26:59 +00:00
Move code to database/entities/user.rs
This commit is contained in:
@@ -152,6 +152,17 @@ impl User {
|
||||
user.status = None;
|
||||
}
|
||||
|
||||
// If the user's status is `Presence::Invisible`, return it as `Presence::Offline`
|
||||
if let Some(mut status) = user.status {
|
||||
if let Some(presence) = status.presence {
|
||||
if presence == Presence::Invisible {
|
||||
status.presence = Some(Presence::Offline);
|
||||
user.status = Some(status);
|
||||
user.online = Some(False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
user.profile = None;
|
||||
user
|
||||
}
|
||||
|
||||
@@ -16,15 +16,5 @@ pub async fn req(user: User, target: Ref) -> Result<Value> {
|
||||
Err(Error::MissingPermission)?
|
||||
}
|
||||
|
||||
// If the user's status is `Presence::Invisible`, return it as `Presence::Offline`
|
||||
if let Some(mut status) = target.status {
|
||||
if let Some(presence) = status.presence {
|
||||
if presence == Presence::Invisible {
|
||||
status.presence = Some(Presence::Offline);
|
||||
target.status = Some(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(json!(target.from(&user).with(perm)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user