forked from jmug/stoatchat
Prevent setting null in edit. Preflight for variables.
This commit is contained in:
@@ -37,9 +37,18 @@ pub async fn req(user: User, target: Ref, info: Json<Data>) -> Result<()> {
|
||||
match &target {
|
||||
Channel::Group { id, .. } => {
|
||||
let col = get_collection("channels");
|
||||
let mut set = doc! {};
|
||||
if let Some(name) = &info.name {
|
||||
set.insert("name", name.clone());
|
||||
}
|
||||
|
||||
if let Some(description) = &info.description {
|
||||
set.insert("description", description.clone());
|
||||
}
|
||||
|
||||
col.update_one(
|
||||
doc! { "_id": &id },
|
||||
doc! { "$set": to_document(&info.0).map_err(|_| Error::DatabaseError { operation: "to_document", with: "info" })? },
|
||||
doc! { "$set": set },
|
||||
None
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -62,6 +62,13 @@ lazy_static! {
|
||||
}
|
||||
|
||||
pub fn preflight_checks() {
|
||||
format!("{}", *MONGO_URI);
|
||||
format!("{}", *PUBLIC_URL);
|
||||
format!("{}", *EXTERNAL_WS_URL);
|
||||
|
||||
format!("{}", *VAPID_PRIVATE_KEY);
|
||||
format!("{}", *VAPID_PUBLIC_KEY);
|
||||
|
||||
if *USE_EMAIL == false {
|
||||
#[cfg(not(debug_assertions))]
|
||||
if !env::var("REVOLT_UNSAFE_NO_EMAIL").map_or(false, |v| v == *"1") {
|
||||
|
||||
Reference in New Issue
Block a user