fix: switch to new permissions enum

This commit is contained in:
Paul Makles
2022-02-22 20:34:23 +00:00
parent aab85fa143
commit 7befd77c5b
37 changed files with 128 additions and 174 deletions

View File

@@ -1,6 +1,6 @@
use revolt_quark::{
models::{Invite, User},
perms, ChannelPermission, Db, Error, Ref, Result,
perms, Db, Error, Permission, Ref, Result,
};
use rocket::serde::json::Json;
@@ -11,13 +11,11 @@ pub async fn req(db: &Db, user: User, target: Ref) -> Result<Json<Invite>> {
if !perms(&user)
.channel(&channel)
.calc_channel(db)
.calc(db)
.await
.get_invite_others()
.can_invite_others()
{
return Err(Error::MissingPermission {
permission: ChannelPermission::InviteOthers as i32,
});
return Error::from_permission(Permission::InviteOthers);
}
Invite::create(db, &user, &channel).await.map(Json)