chore: format code

This commit is contained in:
Paul Makles
2022-02-04 22:19:40 +00:00
parent 88273021a2
commit 8b4541feb0
6 changed files with 39 additions and 26 deletions

View File

@@ -1,15 +1,22 @@
use revolt_quark::{Error, EmptyResponse, Result, models::{User, Channel}, Ref, Db, perms, ChannelPermission};
use revolt_quark::{
models::{Channel, User},
perms, ChannelPermission, Db, EmptyResponse, Error, Ref, Result,
};
use mongodb::bson::doc;
#[put("/<target>/recipients/<member>")]
pub async fn req(
db: &Db,
user: User, target: Ref, member: Ref
) -> Result<EmptyResponse> {
pub async fn req(db: &Db, user: User, target: Ref, member: Ref) -> Result<EmptyResponse> {
let channel = target.as_channel(db).await?;
if !perms(&user).channel(&channel).calc_channel(db).await.get_invite_others() {
return Err(Error::MissingPermission { permission: ChannelPermission::InviteOthers as i32 })
if !perms(&user)
.channel(&channel)
.calc_channel(db)
.await
.get_invite_others()
{
return Err(Error::MissingPermission {
permission: ChannelPermission::InviteOthers as i32,
});
}
match channel {
@@ -18,6 +25,6 @@ pub async fn req(
db.add_user_to_group(&id, &user.id).await?;
Ok(EmptyResponse)
}
_ => Err(Error::InvalidOperation)
_ => Err(Error::InvalidOperation),
}
}