forked from jmug/stoatchat
Add status presence indicator.
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2475,7 +2475,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt"
|
name = "revolt"
|
||||||
version = "0.4.0-alpha.4"
|
version = "0.4.0-alpha.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"async-tungstenite",
|
"async-tungstenite",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt"
|
name = "revolt"
|
||||||
version = "0.4.0-alpha.4"
|
version = "0.4.0-alpha.5"
|
||||||
authors = ["Paul Makles <paulmakles@gmail.com>"]
|
authors = ["Paul Makles <paulmakles@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,21 @@ pub enum Badge {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
pub enum Presence {
|
||||||
|
Online,
|
||||||
|
Idle,
|
||||||
|
Busy,
|
||||||
|
Invisible
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Validate, Serialize, Deserialize, Debug)]
|
#[derive(Validate, Serialize, Deserialize, Debug)]
|
||||||
pub struct UserStatus {
|
pub struct UserStatus {
|
||||||
#[validate(length(min = 1, max = 128))]
|
#[validate(length(min = 1, max = 128))]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
text: Option<String>,
|
text: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
presence: Option<Presence>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Validate, Serialize, Deserialize, Debug)]
|
#[derive(Validate, Serialize, Deserialize, Debug)]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use rocket_contrib::json::JsonValue;
|
|||||||
#[get("/")]
|
#[get("/")]
|
||||||
pub async fn root() -> JsonValue {
|
pub async fn root() -> JsonValue {
|
||||||
json!({
|
json!({
|
||||||
"revolt": "0.4.0-alpha.4",
|
"revolt": "0.4.0-alpha.5",
|
||||||
"features": {
|
"features": {
|
||||||
"registration": !*DISABLE_REGISTRATION,
|
"registration": !*DISABLE_REGISTRATION,
|
||||||
"captcha": {
|
"captcha": {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if target.profile.is_some() {
|
if target.profile.is_some() {
|
||||||
Ok(json!({ "profile": target.profile }))
|
Ok(json!(target.profile))
|
||||||
} else {
|
} else {
|
||||||
Ok(json!({}))
|
Ok(json!({}))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user