From b718e0ba08708e43ce5c65f20eebf0452dc462cd Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 18 Aug 2014 03:10:33 +0200 Subject: [PATCH] changed confusing nomenclature --- Handler/Profile.hs | 19 +++++++++---------- templates/profile.hamlet | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Handler/Profile.hs b/Handler/Profile.hs index 2877642..29cb69a 100644 --- a/Handler/Profile.hs +++ b/Handler/Profile.hs @@ -4,18 +4,17 @@ import Import import Data.Maybe getProfileR :: UserId -> Handler Html -getProfileR user = do - owner <- runDB $ get user +getProfileR ownerId = do + owner <- runDB $ get ownerId ownerName <- lift $ pure $ userName $ fromJust owner - userAlbs <- runDB $ selectList [AlbumOwner ==. user] [Desc AlbumTitle] - recentMedia <- (runDB $ selectList [MediumOwner ==. user] [Desc MediumTime]) + userAlbs <- runDB $ selectList [AlbumOwner ==. ownerId] [Desc AlbumTitle] + recentMedia <- (runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTime]) msu <- lookupSession "userId" - case msu of + presence <- case msu of Just tempUserId -> do userId <- lift $ pure $ getUserIdFromText tempUserId - presence <- lift $ pure $ userId == user - defaultLayout $ do - $(widgetFile "profile") + return (userId == ownerId) Nothing -> - defaultLayout $ do - $(widgetFile "profile") + return False + defaultLayout $ do + $(widgetFile "profile") diff --git a/templates/profile.hamlet b/templates/profile.hamlet index 0d872f1..b0ee21a 100644 --- a/templates/profile.hamlet +++ b/templates/profile.hamlet @@ -7,7 +7,7 @@ $else Albums of this user: $forall (Entity albumId album) <- userAlbs
- +
#{albumTitle album}