forked from jmug/stoatchat
Merge pull request #36 from Zomatree/master
This commit is contained in:
@@ -18,6 +18,8 @@ pub struct Data {
|
||||
#[validate(length(min = 1, max = 128))]
|
||||
icon: Option<String>,
|
||||
remove: Option<RemoveChannelField>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
nsfw: Option<bool>
|
||||
}
|
||||
|
||||
#[patch("/<target>", data = "<data>")]
|
||||
@@ -86,6 +88,10 @@ pub async fn req(user: User, target: Ref, data: Json<Data>) -> Result<EmptyRespo
|
||||
remove_icon = true;
|
||||
}
|
||||
|
||||
if let Some(nsfw) = &data.nsfw {
|
||||
set.insert("nsfw", nsfw);
|
||||
}
|
||||
|
||||
let mut operations = doc! {};
|
||||
if set.len() > 0 {
|
||||
operations.insert("$set", &set);
|
||||
|
||||
@@ -20,6 +20,8 @@ pub struct Data {
|
||||
#[validate(length(min = 1, max = 36))]
|
||||
nonce: String,
|
||||
users: Vec<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
nsfw: Option<bool>
|
||||
}
|
||||
|
||||
#[post("/create", data = "<info>")]
|
||||
@@ -77,7 +79,8 @@ pub async fn req(user: User, info: Json<Data>) -> Result<Value> {
|
||||
recipients: set.into_iter().collect::<Vec<String>>(),
|
||||
icon: None,
|
||||
last_message: None,
|
||||
permissions: None
|
||||
permissions: None,
|
||||
nsfw: info.nsfw.unwrap_or_default()
|
||||
};
|
||||
|
||||
channel.clone().publish().await?;
|
||||
|
||||
Reference in New Issue
Block a user