forgot deleting preview images

This commit is contained in:
nek0 2016-05-04 02:26:48 +02:00
parent 02b0022891
commit 6fb658d5fb
6 changed files with 6 additions and 0 deletions

View file

@ -148,6 +148,7 @@ getAdminAlbumDeleteR albumId = do
medium <- runDB $ getJust a medium <- runDB $ getJust a
liftIO $ removeFile (normalise $ L.tail $ mediumPath medium) liftIO $ removeFile (normalise $ L.tail $ mediumPath medium)
liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium) liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium)
liftIO $ removeFile (normalise $ L.tail $ mediumPreview medium)
-- delete comments -- delete comments
commEnts <- runDB $ selectList [CommentOrigin ==. a] [] commEnts <- runDB $ selectList [CommentOrigin ==. a] []
_ <- mapM (\c -> do _ <- mapM (\c -> do

View file

@ -136,6 +136,7 @@ getAdminMediumDeleteR mediumId = do
-- delete files -- delete files
liftIO $ removeFile (normalise $ tail $ mediumPath medium) liftIO $ removeFile (normalise $ tail $ mediumPath medium)
liftIO $ removeFile (normalise $ tail $ mediumThumb medium) liftIO $ removeFile (normalise $ tail $ mediumThumb medium)
liftIO $ removeFile (normalise $ tail $ mediumPreview medium)
-- outro -- outro
setMessage "Medium deleted successfully" setMessage "Medium deleted successfully"
redirect AdminR redirect AdminR

View file

@ -169,6 +169,7 @@ getAdminProfileDeleteR ownerId = do
medium <- runDB $ getJust med medium <- runDB $ getJust med
liftIO $ removeFile (normalise $ L.tail $ mediumPath medium) liftIO $ removeFile (normalise $ L.tail $ mediumPath medium)
liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium) liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium)
liftIO $ removeFile (normalise $ L.tail $ mediumPreview medium)
-- delete medium database entry and search -- delete medium database entry and search
ium <- runDB $ getJust med ium <- runDB $ getJust med
deleteIndexES $ ESMedium med ium deleteIndexES $ ESMedium med ium

View file

@ -198,6 +198,7 @@ postAlbumDeleteR albumId = do
medium <- runDB $ getJust a medium <- runDB $ getJust a
liftIO $ removeFile (normalise $ L.tail $ mediumPath medium) liftIO $ removeFile (normalise $ L.tail $ mediumPath medium)
liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium) liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium)
liftIO $ removeFile (normalise $ L.tail $ mediumPreview medium)
-- delete medium from elasticsearch -- delete medium from elasticsearch
deleteIndexES (ESMedium a medium) deleteIndexES (ESMedium a medium)
-- delete comments -- delete comments

View file

@ -112,6 +112,7 @@ postMediumDeleteR mediumId = do
runDB $ update albumId [AlbumContent =. newMediaList] runDB $ update albumId [AlbumContent =. newMediaList]
liftIO $ removeFile (normalise $ tail $ mediumPath medium) liftIO $ removeFile (normalise $ tail $ mediumPath medium)
liftIO $ removeFile (normalise $ tail $ mediumThumb medium) liftIO $ removeFile (normalise $ tail $ mediumThumb medium)
liftIO $ removeFile (normalise $ tail $ mediumPreview medium)
runDB $ delete mediumId runDB $ delete mediumId
-- delete form elasticsearch -- delete form elasticsearch
deleteIndexES (ESMedium mediumId medium) deleteIndexES (ESMedium mediumId medium)

View file

@ -64,6 +64,7 @@ postProfileDeleteR userId = do
medium <- runDB $ getJust med medium <- runDB $ getJust med
liftIO $ removeFile (normalise $ L.tail $ mediumPath medium) liftIO $ removeFile (normalise $ L.tail $ mediumPath medium)
liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium) liftIO $ removeFile (normalise $ L.tail $ mediumThumb medium)
liftIO $ removeFile (normalise $ L.tail $ mediumPreview medium)
deleteIndexES (ESMedium med medium) deleteIndexES (ESMedium med medium)
runDB $ delete med runDB $ delete med
) mediaList ) mediaList