add: ability to join/leave/be banned from communities

This commit is contained in:
trisua 2025-03-31 15:39:49 -04:00
parent f3c2157dfc
commit 619184d02e
28 changed files with 618 additions and 197 deletions

View file

@ -13,6 +13,7 @@ bitflags! {
const MEMBER = 1 << 2;
const MANAGE_POSTS = 1 << 3;
const MANAGE_ROLES = 1 << 4;
const BANNED = 1 << 5;
const _ = !0;
}
@ -89,6 +90,9 @@ impl CommunityPermission {
if (self & CommunityPermission::ADMINISTRATOR) == CommunityPermission::ADMINISTRATOR {
// has administrator permission, meaning everything else is automatically true
return true;
} else if (self & CommunityPermission::BANNED) == CommunityPermission::BANNED {
// has banned permission, meaning everything else is automatically false
return false;
}
(self & permission) == permission
@ -107,6 +111,6 @@ impl CommunityPermission {
impl Default for CommunityPermission {
fn default() -> Self {
Self::DEFAULT
Self::DEFAULT | Self::MEMBER
}
}