userid is now userid

This commit is contained in:
nek0 2014-08-15 14:50:03 +02:00
parent 9203377c3b
commit 8e657f148d
4 changed files with 8 additions and 8 deletions

View file

@ -11,7 +11,7 @@ getNewAlbumR = do
case msu of case msu of
Just tempUserId -> do Just tempUserId -> do
userId <- lift $ pure $ getUserIdFromText tempUserId userId <- lift $ pure $ getUserIdFromText tempUserId
(albumWidget, enctype) <- generateFormPost (albumForm $ Key userId) (albumWidget, enctype) <- generateFormPost (albumForm userId)
defaultLayout $ do defaultLayout $ do
$(widgetFile "newAlbum") $(widgetFile "newAlbum")
Nothing -> do Nothing -> do
@ -24,13 +24,13 @@ postNewAlbumR = do
case msu of case msu of
Just tempUserId -> do Just tempUserId -> do
userId <- lift $ pure $ getUserIdFromText tempUserId userId <- lift $ pure $ getUserIdFromText tempUserId
((result, albumWidget), enctype) <- runFormPost (albumForm $ Key userId) ((result, albumWidget), enctype) <- runFormPost (albumForm userId)
case result of case result of
FormSuccess album -> do FormSuccess album -> do
albumId <- runDB $ insert album 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|<pre>Album successfully created|] setMessage $ [shamlet|<pre>Album successfully created|]
redirect $ ProfileR $ Key userId redirect $ ProfileR userId
albumForm :: UserId -> Form Album albumForm :: UserId -> Form Album
albumForm userId = renderDivs $ Album albumForm userId = renderDivs $ Album

View file

@ -13,6 +13,6 @@ getProfileR user = do
case msu of case msu of
Just tempUserId -> do Just tempUserId -> do
userId <- lift $ pure $ getUserIdFromText tempUserId userId <- lift $ pure $ getUserIdFromText tempUserId
presence <- lift $ pure $ (Key userId) == user presence <- lift $ pure $ userId == user
defaultLayout $ do defaultLayout $ do
$(widgetFile "profile") $(widgetFile "profile")

View file

@ -22,7 +22,7 @@ getUploadR = do
case msu of case msu of
Just tempUserId -> do Just tempUserId -> do
userId <- lift $ pure $ getUserIdFromText tempUserId userId <- lift $ pure $ getUserIdFromText tempUserId
(uploadWidget, enctype) <- generateFormPost (uploadForm $ Key userId) (uploadWidget, enctype) <- generateFormPost (uploadForm userId)
defaultLayout $ do defaultLayout $ do
$(widgetFile "upload") $(widgetFile "upload")
Nothing -> do Nothing -> do
@ -35,7 +35,7 @@ postUploadR = do
case msu of case msu of
Just tempUserId -> do Just tempUserId -> do
userId <- lift $ pure $ getUserIdFromText tempUserId userId <- lift $ pure $ getUserIdFromText tempUserId
((result, uploadWidget), enctype) <- runFormPost (uploadForm $ Key userId) ((result, uploadWidget), enctype) <- runFormPost (uploadForm userId)
case result of case result of
FormSuccess temp -> do FormSuccess temp -> do
path <- writeOnDrive $ tempMediumFile temp path <- writeOnDrive $ tempMediumFile temp

View file

@ -19,7 +19,7 @@ import Yesod.Core.Types
getUserIdFromText :: Text -> UserId getUserIdFromText :: Text -> UserId
getUserIdFromText tempUserId = getUserIdFromText tempUserId =
PersistInt64 $ fromIntegral $ read $ unpack tempUserId Key $ PersistInt64 $ fromIntegral $ read $ unpack tempUserId
extractKey :: KeyBackend backend entity -> Text extractKey :: KeyBackend backend entity -> Text
extractKey = extractKey' . unKey extractKey = extractKey' . unKey