Add group creation. Sync channels to clients on creation.
This commit is contained in:
@@ -30,13 +30,17 @@ pub enum Error {
|
||||
Blocked,
|
||||
#[snafu(display("You have been blocked by this user."))]
|
||||
BlockedByOther,
|
||||
#[snafu(display("Not friends with target user."))]
|
||||
NotFriends,
|
||||
|
||||
// ? Channel related errors.
|
||||
#[snafu(display("Already sent a message with this nonce."))]
|
||||
AlreadySentMessage,
|
||||
#[snafu(display("Cannot edit someone else's message."))]
|
||||
CannotEditMessage,
|
||||
|
||||
#[snafu(display("Group size is too large."))]
|
||||
GroupTooLarge {
|
||||
max: usize
|
||||
},
|
||||
|
||||
// ? General errors.
|
||||
#[snafu(display("Failed to validate fields."))]
|
||||
FailedValidation { error: ValidationErrors },
|
||||
@@ -47,6 +51,8 @@ pub enum Error {
|
||||
},
|
||||
#[snafu(display("Internal server error."))]
|
||||
InternalError,
|
||||
#[snafu(display("Already created an object with this nonce."))]
|
||||
DuplicateNonce,
|
||||
#[snafu(display("This request had no effect."))]
|
||||
NoEffect,
|
||||
}
|
||||
@@ -67,13 +73,15 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
Error::AlreadySentRequest => Status::Conflict,
|
||||
Error::Blocked => Status::Conflict,
|
||||
Error::BlockedByOther => Status::Forbidden,
|
||||
Error::NotFriends => Status::Forbidden,
|
||||
|
||||
Error::AlreadySentMessage => Status::Conflict,
|
||||
Error::CannotEditMessage => Status::Forbidden,
|
||||
|
||||
Error::GroupTooLarge { .. } => Status::Forbidden,
|
||||
|
||||
Error::FailedValidation { .. } => Status::UnprocessableEntity,
|
||||
Error::DatabaseError { .. } => Status::InternalServerError,
|
||||
Error::InternalError => Status::InternalServerError,
|
||||
Error::DuplicateNonce => Status::Conflict,
|
||||
Error::NoEffect => Status::Ok,
|
||||
};
|
||||
|
||||
|
||||
@@ -33,10 +33,14 @@ lazy_static! {
|
||||
pub static ref SMTP_HOST: String =
|
||||
env::var("REVOLT_SMTP_HOST").unwrap_or_else(|_| "".to_string());
|
||||
pub static ref SMTP_USERNAME: String =
|
||||
env::var("SMTP_USERNAME").unwrap_or_else(|_| "".to_string());
|
||||
env::var("REVOLT_SMTP_USERNAME").unwrap_or_else(|_| "".to_string());
|
||||
pub static ref SMTP_PASSWORD: String =
|
||||
env::var("SMTP_PASSWORD").unwrap_or_else(|_| "".to_string());
|
||||
pub static ref SMTP_FROM: String = env::var("SMTP_FROM").unwrap_or_else(|_| "".to_string());
|
||||
env::var("REVOLT_SMTP_PASSWORD").unwrap_or_else(|_| "".to_string());
|
||||
pub static ref SMTP_FROM: String = env::var("REVOLT_SMTP_FROM").unwrap_or_else(|_| "".to_string());
|
||||
|
||||
// Application Logic Settings
|
||||
pub static ref MAX_GROUP_SIZE: usize =
|
||||
env::var("REVOLT_MAX_GROUP_SIZE").unwrap_or_else(|_| "50".to_string()).parse().unwrap();
|
||||
}
|
||||
|
||||
pub fn preflight_checks() {
|
||||
|
||||
Reference in New Issue
Block a user