fix: Pass the download ID directly in the DeleteDownload event when publishing into the networking channel

This commit is contained in:
2024-12-17 15:14:17 -07:00
parent a308b8fe95
commit a7da73300c
6 changed files with 43 additions and 59 deletions
+12 -2
View File
@@ -27,6 +27,16 @@ impl<'a, 'b> DownloadsHandler<'a, 'b> {
self.app.data.radarr_data.downloads,
DownloadRecord
);
fn extract_download_id(&self) -> i64 {
self
.app
.data
.radarr_data
.downloads
.current_selection()
.id
}
}
impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for DownloadsHandler<'a, 'b> {
@@ -95,7 +105,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for DownloadsHandler<'a,
match self.active_radarr_block {
ActiveRadarrBlock::DeleteDownloadPrompt => {
if self.app.data.radarr_data.prompt_confirm {
self.app.data.radarr_data.prompt_confirm_action = Some(RadarrEvent::DeleteDownload(None));
self.app.data.radarr_data.prompt_confirm_action = Some(RadarrEvent::DeleteDownload(self.extract_download_id()));
}
self.app.pop_navigation_stack();
@@ -138,7 +148,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for DownloadsHandler<'a,
ActiveRadarrBlock::DeleteDownloadPrompt => {
if key == DEFAULT_KEYBINDINGS.confirm.key {
self.app.data.radarr_data.prompt_confirm = true;
self.app.data.radarr_data.prompt_confirm_action = Some(RadarrEvent::DeleteDownload(None));
self.app.data.radarr_data.prompt_confirm_action = Some(RadarrEvent::DeleteDownload(self.extract_download_id()));
self.app.pop_navigation_stack();
}