fixed upload issue with shared albums
This commit is contained in:
parent
71dc85f94b
commit
1726643f25
3 changed files with 13 additions and 6 deletions
|
@ -16,8 +16,10 @@ getMediumSettingsR mediumId = do
|
||||||
case msu of
|
case msu of
|
||||||
Just tempUserId -> do
|
Just tempUserId -> do
|
||||||
userId <- return $ getUserIdFromText tempUserId
|
userId <- return $ getUserIdFromText tempUserId
|
||||||
|
album <- runDB $ getJust $ mediumAlbum medium
|
||||||
presence <- return (userId == ownerId)
|
presence <- return (userId == ownerId)
|
||||||
case presence of
|
albumOwnerPresence <- return (userId == (albumOwner album))
|
||||||
|
case presence || albumOwnerPresence of
|
||||||
True -> do
|
True -> do
|
||||||
(mediumSettingsWidget, enctype) <- generateFormPost $ mediumSettingsForm medium
|
(mediumSettingsWidget, enctype) <- generateFormPost $ mediumSettingsForm medium
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
@ -44,8 +46,10 @@ postMediumSettingsR mediumId = do
|
||||||
case msu of
|
case msu of
|
||||||
Just tempUserId -> do
|
Just tempUserId -> do
|
||||||
userId <- return $ getUserIdFromText tempUserId
|
userId <- return $ getUserIdFromText tempUserId
|
||||||
|
album <- runDB $ getJust $ mediumAlbum medium
|
||||||
presence <- return (userId == ownerId)
|
presence <- return (userId == ownerId)
|
||||||
case presence of
|
albumOwnerPresence <- return (userId == (albumOwner album))
|
||||||
|
case presence || albumOwnerPresence of
|
||||||
True -> do
|
True -> do
|
||||||
((result, mediumSettingsWidget), enctype) <- runFormPost $ mediumSettingsForm medium
|
((result, mediumSettingsWidget), enctype) <- runFormPost $ mediumSettingsForm medium
|
||||||
case result of
|
case result of
|
||||||
|
|
|
@ -29,7 +29,7 @@ getUploadR = do
|
||||||
msu <- lookupSession "userId"
|
msu <- lookupSession "userId"
|
||||||
case msu of
|
case msu of
|
||||||
Just tempUserId -> do
|
Just tempUserId -> do
|
||||||
userId <- lift $ pure $ getUserIdFromText tempUserId
|
userId <- return $ getUserIdFromText tempUserId
|
||||||
(uploadWidget, enctype) <- generateFormPost (uploadForm userId)
|
(uploadWidget, enctype) <- generateFormPost (uploadForm userId)
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle "Eidolon :: Upload Medium"
|
setTitle "Eidolon :: Upload Medium"
|
||||||
|
@ -50,8 +50,10 @@ postUploadR = do
|
||||||
fil <- return $ tempMediumFile temp
|
fil <- return $ tempMediumFile temp
|
||||||
case (fileContentType fil) `elem` acceptedTypes of
|
case (fileContentType fil) `elem` acceptedTypes of
|
||||||
True -> do
|
True -> do
|
||||||
path <- writeOnDrive fil userId (tempMediumAlbum temp)
|
albRef <- runDB $ getJust (tempMediumAlbum temp)
|
||||||
thumbPath <- generateThumb path userId (tempMediumAlbum temp)
|
ownerId <- return $ albumOwner albRef
|
||||||
|
path <- writeOnDrive fil ownerId (tempMediumAlbum temp)
|
||||||
|
thumbPath <- generateThumb path ownerId (tempMediumAlbum temp)
|
||||||
inAlbumId <- return $ tempMediumAlbum temp
|
inAlbumId <- return $ tempMediumAlbum temp
|
||||||
medium <- return $ Medium
|
medium <- return $ Medium
|
||||||
(tempMediumTitle temp)
|
(tempMediumTitle temp)
|
||||||
|
|
|
@ -6,4 +6,5 @@ $newline always
|
||||||
<div>
|
<div>
|
||||||
<input type=submit value="Change settings">
|
<input type=submit value="Change settings">
|
||||||
|
|
||||||
|
$if presence == True
|
||||||
<a href=@{MediumDeleteR mediumId}>Delete this image
|
<a href=@{MediumDeleteR mediumId}>Delete this image
|
||||||
|
|
Loading…
Reference in a new issue