diff --git a/Cargo.lock b/Cargo.lock index 90cb3eb3..91ad0db0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2475,7 +2475,7 @@ dependencies = [ [[package]] name = "revolt" -version = "0.4.0-alpha.4" +version = "0.4.0-alpha.5" dependencies = [ "async-std", "async-tungstenite", diff --git a/Cargo.toml b/Cargo.toml index 26f7933a..40d96853 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revolt" -version = "0.4.0-alpha.4" +version = "0.4.0-alpha.5" authors = ["Paul Makles "] edition = "2018" diff --git a/src/database/entities/user.rs b/src/database/entities/user.rs index 51580699..c3b7b2ce 100644 --- a/src/database/entities/user.rs +++ b/src/database/entities/user.rs @@ -33,11 +33,21 @@ pub enum Badge { } */ +#[derive(Serialize, Deserialize, Debug)] +pub enum Presence { + Online, + Idle, + Busy, + Invisible +} + #[derive(Validate, Serialize, Deserialize, Debug)] pub struct UserStatus { #[validate(length(min = 1, max = 128))] #[serde(skip_serializing_if = "Option::is_none")] text: Option, + #[serde(skip_serializing_if = "Option::is_none")] + presence: Option } #[derive(Validate, Serialize, Deserialize, Debug)] diff --git a/src/routes/root.rs b/src/routes/root.rs index 96282d39..719af3d5 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -9,7 +9,7 @@ use rocket_contrib::json::JsonValue; #[get("/")] pub async fn root() -> JsonValue { json!({ - "revolt": "0.4.0-alpha.4", + "revolt": "0.4.0-alpha.5", "features": { "registration": !*DISABLE_REGISTRATION, "captcha": { diff --git a/src/routes/users/fetch_profile.rs b/src/routes/users/fetch_profile.rs index 089f88e6..7975f814 100644 --- a/src/routes/users/fetch_profile.rs +++ b/src/routes/users/fetch_profile.rs @@ -17,7 +17,7 @@ pub async fn req(user: User, target: Ref) -> Result { } if target.profile.is_some() { - Ok(json!({ "profile": target.profile })) + Ok(json!(target.profile)) } else { Ok(json!({})) }