Skip to content

Commit

Permalink
Merge pull request #399 from slumber/playlists-fix
Browse files Browse the repository at this point in the history
Correctly handle playlist unfollowing
  • Loading branch information
Rigellute committed Apr 16, 2020
2 parents 633ff72 + e8ed863 commit c4a46c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,19 @@ impl App {
}
}

pub fn user_unfollow_playlist_search_result(&mut self) {
if let (Some(playlists), Some(selected_index), Some(user)) = (
&self.search_results.playlists,
self.search_results.selected_playlists_index,
&self.user,
) {
let selected_playlist = &playlists.playlists.items[selected_index];
let selected_id = selected_playlist.id.clone();
let user_id = user.id.clone();
self.dispatch(IoEvent::UserUnfollowPlaylist(user_id, selected_id))
}
}

pub fn get_made_for_you(&mut self) {
// TODO: replace searches when relevant endpoint is added
const DISCOVER_WEEKLY: &str = "Discover Weekly";
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/search_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ pub fn handler(key: Key, app: &mut App) {
SearchResultBlock::SongSearch => {}
SearchResultBlock::ArtistSearch => app.user_unfollow_artists(ActiveBlock::SearchResultBlock),
SearchResultBlock::PlaylistSearch => {
app.user_unfollow_playlist();
app.user_unfollow_playlist_search_result();
}
SearchResultBlock::Empty => {}
},
Expand Down

0 comments on commit c4a46c7

Please sign in to comment.