Skip to content

Commit

Permalink
Merge pull request #164 from SamTV12345/fix/deleting-podcasts
Browse files Browse the repository at this point in the history
Fixes deleting podcasts.
  • Loading branch information
SamTV12345 authored May 29, 2023
2 parents cefb26a + 9fc02b6 commit 65449f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/controllers/podcast_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ pub async fn delete_podcast(data: web::Json<DeletePodcast>, db: Data<DbPool>, id
let podcast = DB::get_podcast(&mut *db.get().unwrap(), id.clone()).expect("Error \
finding podcast");
if data.delete_files{
FileService::delete_podcast_files(&podcast.directory_id);
FileService::delete_podcast_files(&podcast.directory_name);
}

DB::delete_watchtime(&mut *db.get().unwrap(), id.clone()).expect("Error deleting \
Expand Down
10 changes: 5 additions & 5 deletions ui/src/components/PodcastDelete.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {setConfirmModalData, setPodcasts} from "../store/CommonSlice";
import {Podcast, setConfirmModalData, setPodcasts} from "../store/CommonSlice";
import {setModalOpen} from "../store/ModalSlice";
import {useAppDispatch, useAppSelector} from "../store/hooks";
import {useTranslation} from "react-i18next";
Expand All @@ -21,10 +21,10 @@ export const PodcastDelete = () => {
}
},[])

const deletePodcast = (withFiles:boolean, podcast_id: number)=>{
const deletePodcast = (withFiles: boolean, podcast_id: number, p: Podcast)=>{
axios.delete(apiURL+"/podcast/"+podcast_id,{data: {delete_files: withFiles}})
.then(()=>{
enqueueSnackbar(t('podcast-deleted'),{variant: "success"})
enqueueSnackbar(t('podcast-deleted', {name: p.name}),{variant: "success"})
})
}

Expand All @@ -40,7 +40,7 @@ export const PodcastDelete = () => {
dispatch(setConfirmModalData({
headerText: t('delete-podcast-with-files'),
onAccept:()=>{
deletePodcast(true, p.id)
deletePodcast(true, p.id, p)
},
onReject: ()=>{
dispatch(setModalOpen(false))
Expand All @@ -55,7 +55,7 @@ export const PodcastDelete = () => {
dispatch(setConfirmModalData({
headerText: t('delete-podcast-without-files'),
onAccept:()=>{
deletePodcast(false, p.id)
deletePodcast(false, p.id, p)
},
onReject: ()=>{
dispatch(setModalOpen(false))
Expand Down

0 comments on commit 65449f2

Please sign in to comment.