support internal icon
This commit is contained in:
@@ -37,6 +37,7 @@ pub struct ProfileSummary {
|
||||
pub name: String,
|
||||
pub email: Option<String>,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_icon: Option<String>,
|
||||
pub avatar_label: String,
|
||||
pub path: String,
|
||||
}
|
||||
@@ -67,6 +68,7 @@ pub struct AssociatedProfileSummary {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_icon: Option<String>,
|
||||
pub avatar_label: String,
|
||||
}
|
||||
|
||||
@@ -76,6 +78,7 @@ pub struct BookmarkAssociatedProfileSummary {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub avatar_data_url: Option<String>,
|
||||
pub avatar_icon: Option<String>,
|
||||
pub avatar_label: String,
|
||||
pub bookmark_path: String,
|
||||
}
|
||||
|
||||
@@ -154,6 +154,11 @@ fn build_profile_summary(
|
||||
.map(str::to_string);
|
||||
|
||||
let avatar_data_url = resolve_profile_avatar(root, profile_path, profile_info);
|
||||
let avatar_icon = profile_info
|
||||
.and_then(|value| value.get("avatar_icon"))
|
||||
.and_then(Value::as_str)
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(str::to_string);
|
||||
let avatar_label = name
|
||||
.chars()
|
||||
.find(|character| !character.is_whitespace())
|
||||
@@ -165,6 +170,7 @@ fn build_profile_summary(
|
||||
name,
|
||||
email,
|
||||
avatar_data_url,
|
||||
avatar_icon,
|
||||
avatar_label,
|
||||
path: profile_path.display().to_string(),
|
||||
}
|
||||
@@ -255,6 +261,7 @@ fn scan_extensions_for_profile(
|
||||
id: profile.id.clone(),
|
||||
name: profile.name.clone(),
|
||||
avatar_data_url: profile.avatar_data_url.clone(),
|
||||
avatar_icon: profile.avatar_icon.clone(),
|
||||
avatar_label: profile.avatar_label.clone(),
|
||||
});
|
||||
}
|
||||
@@ -415,6 +422,7 @@ fn collect_bookmarks(
|
||||
id: profile.id.clone(),
|
||||
name: profile.name.clone(),
|
||||
avatar_data_url: profile.avatar_data_url.clone(),
|
||||
avatar_icon: profile.avatar_icon.clone(),
|
||||
avatar_label: profile.avatar_label.clone(),
|
||||
bookmark_path,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user