Skip to content
Snippets Groups Projects
Commit 56bd7638 authored by insert's avatar insert
Browse files

Prevent setting null in edit. Preflight for variables.

parent 32cd9d8a
No related merge requests found
Pipeline #802 passed with stage
in 10 minutes and 25 seconds
......@@ -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") {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment