mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 21:47:02 +00:00
Fix guild creation, disable registration.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
use super::get_collection;
|
||||
|
||||
use lru::LruCache;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use mongodb::bson::{doc, from_bson, Bson};
|
||||
use rocket::http::RawStr;
|
||||
use rocket::request::FromParam;
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct LastMessage {
|
||||
|
||||
@@ -36,6 +36,12 @@ pub fn create(info: Json<Create>) -> Response {
|
||||
);
|
||||
}
|
||||
|
||||
if true {
|
||||
return Response::BadRequest(
|
||||
json!({ "error": "Registration disabled." })
|
||||
);
|
||||
}
|
||||
|
||||
let col = database::get_collection("users");
|
||||
|
||||
if info.username.len() < 2 || info.username.len() > 32 {
|
||||
|
||||
@@ -537,6 +537,7 @@ pub fn create_guild(user: User, info: Json<CreateGuild>) -> Response {
|
||||
"name": name,
|
||||
"description": description,
|
||||
"owner": &user.id,
|
||||
"channels": [ channel_id.clone() ],
|
||||
"invites": [],
|
||||
"bans": [],
|
||||
"default_permissions": 51,
|
||||
|
||||
Reference in New Issue
Block a user