changed album logic
This commit is contained in:
parent
8b6d75a997
commit
72e4f16125
1 changed files with 21 additions and 15 deletions
|
@ -2,18 +2,24 @@ module Handler.Album where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|
||||||
getAlbumR :: UserId -> AlbumId -> Handler Html
|
getAlbumR :: AlbumId -> Handler Html
|
||||||
getAlbumR ownerId albumId = do
|
getAlbumR albumId = do
|
||||||
owner <- runDB $ getJust ownerId
|
tempAlbum <- runDB $ get albumId
|
||||||
ownerName <- lift $ pure $ userName owner
|
case tempAlbum of
|
||||||
album <- runDB $ getJust albumId
|
Just album -> do
|
||||||
msu <- lookupSession "userId"
|
ownerId <- return $ albumOwner album
|
||||||
presence <- case msu of
|
owner <- runDB $ getJust ownerId
|
||||||
Just tempUserId -> do
|
ownerName <- return $ userName owner
|
||||||
userId <- lift $ pure $ getUserIdFromText tempUserId
|
msu <- lookupSession "userId"
|
||||||
return (userId == ownerId)
|
presence <- case msu of
|
||||||
Nothing ->
|
Just tempUserId -> do
|
||||||
return False
|
userId <- return $ getUserIdFromText tempUserId
|
||||||
media <- mapM (\a -> runDB $ getJust a) (albumContent album)
|
return (userId == ownerId)
|
||||||
defaultLayout $ do
|
Nothing ->
|
||||||
$(widgetFile "album")
|
return False
|
||||||
|
media <- mapM (\a -> runDB $ getJust a) (albumContent album)
|
||||||
|
defaultLayout $ do
|
||||||
|
$(widgetFile "album")
|
||||||
|
Nothing -> do
|
||||||
|
setMessage "This album does not exist"
|
||||||
|
redirect $ HomeR
|
||||||
|
|
Loading…
Reference in a new issue