1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-26 13:38:51 +00:00

Account image URL is null if unset

This commit is contained in:
Pierre HUBERT 2021-07-12 18:43:17 +02:00
parent e5b64746b4
commit c14a0da518
3 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,7 @@ pub struct AdminSearchUserResult {
first_name: String,
last_name: String,
email: String,
account_image: String
account_image: Option<String>
}
impl AdminSearchUserResult {

View File

@ -16,7 +16,7 @@ pub struct AdminUserInfoAPI {
last_activity: u64,
page_visibility: &'static str,
directory: Option<String>,
account_image: String,
account_image: Option<String>,
account_image_visibility: String,
friend_list_public: bool,
is_email_public: bool,

View File

@ -182,11 +182,11 @@ impl User {
/// Get the URL pointing to a user account image for an administrator. An administrator can
/// only access to the user account image if it is visible to all Comunic users
pub fn account_image_url_for_admin(&self) -> String {
pub fn account_image_url_for_admin(&self) -> Option<String> {
match (&self.account_image_visibility, &self.account_image_path) {
(AccountImageVisibility::FRIENDS, _) => User::error_account_image_url(),
(_, None) => User::default_account_image_url(),
(_, Some(path)) => user_data_url(path),
(_, None) => None,
(AccountImageVisibility::FRIENDS, _) => Some(User::error_account_image_url()),
(_, Some(path)) => Some(user_data_url(path)),
}
}