feat: implement admin account disable functionality
This commit is contained in:
@@ -37,9 +37,7 @@ impl IntoResponse for Error {
|
||||
ErrorType::NotAMember => StatusCode::BAD_REQUEST,
|
||||
ErrorType::AlreadyPinned => StatusCode::BAD_REQUEST,
|
||||
ErrorType::NotPinned => StatusCode::BAD_REQUEST,
|
||||
ErrorType::InSlowmode {
|
||||
retry_after: _,
|
||||
} => StatusCode::TOO_MANY_REQUESTS,
|
||||
ErrorType::InSlowmode { retry_after: _ } => StatusCode::TOO_MANY_REQUESTS,
|
||||
ErrorType::InviteExists => StatusCode::BAD_REQUEST,
|
||||
|
||||
ErrorType::CantCreateServers => StatusCode::FORBIDDEN,
|
||||
@@ -98,6 +96,8 @@ impl IntoResponse for Error {
|
||||
ErrorType::NoEmbedData => StatusCode::BAD_REQUEST,
|
||||
|
||||
ErrorType::ImATeaPot => StatusCode::IM_A_TEAPOT,
|
||||
|
||||
ErrorType::PrivilegedAccount => StatusCode::FORBIDDEN,
|
||||
};
|
||||
|
||||
(status, Json(&self)).into_response()
|
||||
|
||||
@@ -190,6 +190,9 @@ pub enum ErrorType {
|
||||
feature: String,
|
||||
},
|
||||
|
||||
// ? Admin API relate errors
|
||||
PrivilegedAccount,
|
||||
|
||||
// :)
|
||||
ImATeaPot,
|
||||
}
|
||||
|
||||
@@ -43,9 +43,7 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
ErrorType::NotAMember => Status::BadRequest,
|
||||
ErrorType::AlreadyPinned => Status::BadRequest,
|
||||
ErrorType::NotPinned => Status::BadRequest,
|
||||
ErrorType::InSlowmode {
|
||||
retry_after: _,
|
||||
} => Status::TooManyRequests,
|
||||
ErrorType::InSlowmode { retry_after: _ } => Status::TooManyRequests,
|
||||
ErrorType::InvalidFlagValue => Status::BadRequest,
|
||||
ErrorType::InviteExists => Status::BadRequest,
|
||||
|
||||
@@ -104,6 +102,8 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
ErrorType::VosoUnavailable => Status::BadRequest,
|
||||
|
||||
ErrorType::ImATeaPot => Status::ImATeapot,
|
||||
|
||||
ErrorType::PrivilegedAccount => Status::Forbidden,
|
||||
};
|
||||
|
||||
// Serialize the error data structure into JSON.
|
||||
|
||||
Reference in New Issue
Block a user