2014-08-12 21:45:33 +00:00
|
|
|
module Handler.Profile where
|
|
|
|
|
|
|
|
import Import
|
2014-08-15 11:25:33 +00:00
|
|
|
import Data.Maybe
|
2014-08-12 21:45:33 +00:00
|
|
|
|
2014-08-14 00:26:21 +00:00
|
|
|
getProfileR :: UserId -> Handler Html
|
2014-08-15 11:25:33 +00:00
|
|
|
getProfileR user = do
|
|
|
|
owner <- runDB $ get user
|
|
|
|
ownerName <- lift $ pure $ userName $ fromJust owner
|
|
|
|
userAlbums <- runDB $ selectList [AlbumOwner ==. user] [Desc AlbumTitle]
|
|
|
|
recentMedia <- (runDB $ selectList [MediumOwner ==. user] [Desc MediumTime])
|
|
|
|
msu <- lookupSession "userId"
|
|
|
|
case msu of
|
|
|
|
Just tempUserId -> do
|
|
|
|
userId <- lift $ pure $ getUserIdFromText tempUserId
|
|
|
|
presence <- lift $ pure $ (Key userId) == user
|
|
|
|
defaultLayout $ do
|
|
|
|
$(widgetFile "profile")
|