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
+5 -19
View File
@@ -40,7 +40,7 @@ pub enum RadarrEvent {
AddTag(String),
ClearBlocklist,
DeleteBlocklistItem(i64),
DeleteDownload(Option<i64>),
DeleteDownload(i64),
DeleteIndexer(Option<i64>),
DeleteMovie(Option<DeleteMovieParams>),
DeleteRootFolder(Option<i64>),
@@ -407,30 +407,16 @@ impl<'a, 'b> Network<'a, 'b> {
.await
}
async fn delete_radarr_download(&mut self, download_id: Option<i64>) -> Result<()> {
let event = RadarrEvent::DeleteDownload(None);
let id = if let Some(dl_id) = download_id {
dl_id
} else {
self
.app
.lock()
.await
.data
.radarr_data
.downloads
.current_selection()
.id
};
info!("Deleting Radarr download for download with id: {id}");
async fn delete_radarr_download(&mut self, download_id: i64) -> Result<()> {
let event = RadarrEvent::DeleteDownload(download_id);
info!("Deleting Radarr download for download with id: {download_id}");
let request_props = self
.request_props_from(
event,
RequestMethod::Delete,
None::<()>,
Some(format!("/{id}")),
Some(format!("/{download_id}")),
None,
)
.await;