Only show playlists where the user is allowed to add tracks when trying to add tracks (#329)

* Only show playlists where the user is allowed to add tracks

* Expose user_id from library and use it to reduce api calls
This commit is contained in:
André Andersson
2020-11-22 19:26:20 +01:00
committed by GitHub
parent 68d2bbd64f
commit d1211e6901
3 changed files with 8 additions and 2 deletions

View File

@@ -38,9 +38,12 @@ impl ContextMenu {
track: Track,
) -> Modal<Dialog> {
let mut list_select: SelectView<Playlist> = SelectView::new().autojump();
let current_user_id = library.user_id.as_ref().unwrap();
for list in library.items().iter() {
list_select.add_item(list.name.clone(), list.clone());
if current_user_id == &list.owner_id || list.collaborative {
list_select.add_item(list.name.clone(), list.clone());
}
}
list_select.set_on_submit(move |s, selected| {