mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-09-25 22:29:45 +00:00
Can determine post access level
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
use crate::data::group_id::GroupID;
|
||||
use crate::data::user::UserID;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum PostVisibilityLevel {
|
||||
//Posts that can be seen by anyone
|
||||
@@ -31,6 +32,33 @@ impl PostVisibilityLevel {
|
||||
}
|
||||
}
|
||||
|
||||
/// Post access level (for a given user)
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum PostAccessLevel {
|
||||
//When a user can't access to a post
|
||||
NO_ACCESS = 0,
|
||||
|
||||
//When a user can see a post and perform basic actions such as liking
|
||||
BASIC_ACCESS = 1,
|
||||
|
||||
//When a user has intermediate access to the post (delete post)
|
||||
INTERMEDIATE_ACCESS = 2,
|
||||
|
||||
//When a user has a full access to the post
|
||||
FULL_ACCESS = 3,
|
||||
}
|
||||
|
||||
impl PostAccessLevel {
|
||||
pub fn to_api(&self) -> String {
|
||||
match self {
|
||||
PostAccessLevel::NO_ACCESS => "no-access",
|
||||
PostAccessLevel::BASIC_ACCESS => "basic",
|
||||
PostAccessLevel::INTERMEDIATE_ACCESS => "intermediate",
|
||||
PostAccessLevel::FULL_ACCESS => "full",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum PostPageKind {
|
||||
PAGE_KIND_USER(UserID),
|
||||
|
Reference in New Issue
Block a user