fix(radarr): Pass in the search query for the SearchNewMovie event when publishing to the networking channel
This commit is contained in:
@@ -103,7 +103,7 @@ impl<'a> App<'a> {
|
||||
}
|
||||
ActiveRadarrBlock::AddMovieSearchResults => {
|
||||
self
|
||||
.dispatch_network_event(RadarrEvent::SearchNewMovie(None).into())
|
||||
.dispatch_network_event(RadarrEvent::SearchNewMovie(self.extract_movie_search_query().await).into())
|
||||
.await;
|
||||
}
|
||||
ActiveRadarrBlock::MovieDetails | ActiveRadarrBlock::FileInfo => {
|
||||
@@ -219,7 +219,7 @@ impl<'a> App<'a> {
|
||||
.collection_movies
|
||||
.set_items(collection_movies);
|
||||
}
|
||||
|
||||
|
||||
async fn extract_movie_id(&self) -> i64 {
|
||||
self
|
||||
.data
|
||||
@@ -229,4 +229,8 @@ impl<'a> App<'a> {
|
||||
.clone()
|
||||
.id
|
||||
}
|
||||
|
||||
async fn extract_movie_search_query(&self) -> String {
|
||||
self.data.radarr_data.add_movie_search.as_ref().expect("Add movie search is empty").text.clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,6 +305,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn test_dispatch_by_add_movie_search_results_block() {
|
||||
let (mut app, mut sync_network_rx) = construct_app_unit();
|
||||
app.data.radarr_data.add_movie_search = Some("test".into());
|
||||
|
||||
app
|
||||
.dispatch_by_radarr_block(&ActiveRadarrBlock::AddMovieSearchResults)
|
||||
@@ -313,7 +314,7 @@ mod tests {
|
||||
assert!(app.is_loading);
|
||||
assert_eq!(
|
||||
sync_network_rx.recv().await.unwrap(),
|
||||
RadarrEvent::SearchNewMovie(None).into()
|
||||
RadarrEvent::SearchNewMovie("test".into()).into()
|
||||
);
|
||||
assert!(!app.data.radarr_data.prompt_confirm);
|
||||
assert_eq!(app.tick_count, 0);
|
||||
|
||||
Reference in New Issue
Block a user