userid is now userid
This commit is contained in:
parent
9203377c3b
commit
8e657f148d
4 changed files with 8 additions and 8 deletions
|
@ -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|<pre>Album successfully created|]
|
||||
redirect $ ProfileR $ Key userId
|
||||
redirect $ ProfileR userId
|
||||
|
||||
albumForm :: UserId -> Form Album
|
||||
albumForm userId = renderDivs $ Album
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue