1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can get general settings

This commit is contained in:
2020-07-14 11:15:20 +02:00
parent fb7f56c359
commit dcd8b07b60
7 changed files with 79 additions and 2 deletions

View File

@ -76,6 +76,7 @@ pub struct User {
pub block_comments_on_his_page: bool,
pub allow_posts_from_friends: bool,
pub account_creation_time: u64,
pub allow_mails: bool,
pub security_question_1: Option<String>,
pub security_answer_1: Option<String>,
pub security_question_2: Option<String>,
@ -83,6 +84,16 @@ pub struct User {
}
impl User {
/// Check if user's page is public
pub fn is_page_public(&self) -> bool {
!matches!(self.status, UserPageStatus::PRIVATE)
}
/// Check if user's page is open
pub fn is_page_open(&self) -> bool {
matches!(self.status, UserPageStatus::OPEN)
}
/// Get the URL pointing to the default account image
pub fn default_account_image_url() -> String {
user_data_url(crate::constants::DEFAULT_ACCOUNT_IMAGE)