From 8e657f148d59aa1e0b9f81f5a8938495f23f536a Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 15 Aug 2014 14:50:03 +0200 Subject: [PATCH] userid is now userid --- Handler/NewAlbum.hs | 8 ++++---- Handler/Profile.hs | 2 +- Handler/Upload.hs | 4 ++-- Helper.hs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) 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