diff --git a/Handler/NewAlbum.hs b/Handler/NewAlbum.hs index 44b1a29..dec8351 100644 --- a/Handler/NewAlbum.hs +++ b/Handler/NewAlbum.hs @@ -11,7 +11,7 @@ getNewAlbumR = do case msu of Just tempUserId -> do userId <- lift $ pure $ getUserIdFromText tempUserId - (albumWidget, enctype) <- generateFormPost (albumForm $ Key userId) + (albumWidget, enctype) <- generateFormPost (albumForm userId) defaultLayout $ do $(widgetFile "newAlbum") Nothing -> do @@ -24,13 +24,13 @@ postNewAlbumR = do case msu of Just tempUserId -> do userId <- lift $ pure $ getUserIdFromText tempUserId - ((result, albumWidget), enctype) <- runFormPost (albumForm $ Key userId) + ((result, albumWidget), enctype) <- runFormPost (albumForm userId) case result of FormSuccess album -> do albumId <- runDB $ insert album - liftIO $ createDirectory $ "data" > (unpack $ extractKey $ Key userId) > (unpack $ extractKey albumId) + liftIO $ createDirectory $ "data" > (unpack $ extractKey userId) > (unpack $ extractKey albumId) setMessage $ [shamlet|
Album successfully created|] - redirect $ ProfileR $ Key userId + redirect $ ProfileR userId albumForm :: UserId -> Form Album albumForm userId = renderDivs $ Album diff --git a/Handler/Profile.hs b/Handler/Profile.hs index 4eb51e6..18b27de 100644 --- a/Handler/Profile.hs +++ b/Handler/Profile.hs @@ -13,6 +13,6 @@ getProfileR user = do case msu of Just tempUserId -> do userId <- lift $ pure $ getUserIdFromText tempUserId - presence <- lift $ pure $ (Key userId) == user + presence <- lift $ pure $ userId == user defaultLayout $ do $(widgetFile "profile") diff --git a/Handler/Upload.hs b/Handler/Upload.hs index 8d91ef7..f280991 100644 --- a/Handler/Upload.hs +++ b/Handler/Upload.hs @@ -22,7 +22,7 @@ getUploadR = do case msu of Just tempUserId -> do userId <- lift $ pure $ getUserIdFromText tempUserId - (uploadWidget, enctype) <- generateFormPost (uploadForm $ Key userId) + (uploadWidget, enctype) <- generateFormPost (uploadForm userId) defaultLayout $ do $(widgetFile "upload") Nothing -> do @@ -35,7 +35,7 @@ postUploadR = do case msu of Just tempUserId -> do userId <- lift $ pure $ getUserIdFromText tempUserId - ((result, uploadWidget), enctype) <- runFormPost (uploadForm $ Key userId) + ((result, uploadWidget), enctype) <- runFormPost (uploadForm userId) case result of FormSuccess temp -> do path <- writeOnDrive $ tempMediumFile temp diff --git a/Helper.hs b/Helper.hs index c296a21..3582be4 100644 --- a/Helper.hs +++ b/Helper.hs @@ -19,7 +19,7 @@ import Yesod.Core.Types getUserIdFromText :: Text -> UserId getUserIdFromText tempUserId = - PersistInt64 $ fromIntegral $ read $ unpack tempUserId + Key $ PersistInt64 $ fromIntegral $ read $ unpack tempUserId extractKey :: KeyBackend backend entity -> Text extractKey = extractKey' . unKey