Add 'hide_display_names' config option
This commit is contained in:
committed by
Henrik Friedrichsen
parent
0cb1aa5d96
commit
ed10872ca3
@@ -74,6 +74,7 @@ pub struct ConfigValues {
|
||||
pub playback_state: Option<PlaybackState>,
|
||||
pub track_format: Option<TrackFormat>,
|
||||
pub library_tabs: Option<Vec<LibraryTab>>,
|
||||
pub hide_display_names: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
|
||||
@@ -191,10 +191,11 @@ impl ListItem for Playlist {
|
||||
}
|
||||
}
|
||||
|
||||
fn display_left(&self, _library: Arc<Library>) -> String {
|
||||
match self.owner_name.as_ref() {
|
||||
Some(owner) => format!("{} • {}", self.name, owner),
|
||||
None => self.name.clone(),
|
||||
fn display_left(&self, library: Arc<Library>) -> String {
|
||||
let hide_owners = library.cfg.values().hide_display_names.unwrap_or(false);
|
||||
match (self.owner_name.as_ref(), hide_owners) {
|
||||
(Some(owner), false) => format!("{} • {}", self.name, owner),
|
||||
_ => self.name.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,19 @@ impl LibraryView {
|
||||
|
||||
Self {
|
||||
tabs: tabview,
|
||||
display_name: library.display_name.clone(),
|
||||
display_name: {
|
||||
let hide_username = library
|
||||
.cfg
|
||||
.values()
|
||||
.hide_display_names
|
||||
.clone()
|
||||
.unwrap_or(false);
|
||||
if hide_username {
|
||||
None
|
||||
} else {
|
||||
library.display_name.clone()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user