diff --git a/src/Vervis/Handler/Person.hs b/src/Vervis/Handler/Person.hs
index b4820dd..116bf21 100644
--- a/src/Vervis/Handler/Person.hs
+++ b/src/Vervis/Handler/Person.hs
@@ -87,14 +87,10 @@ getPersonNewR = do
getPersonR :: Text -> Handler Html
getPersonR ident = do
- people <- runDB $ select $ from $ \ (sharer, person) -> do
- where_ $
- sharer ^. SharerIdent ==. val ident &&.
- sharer ^. SharerId ==. person ^. PersonIdent
- return person
- case people of
- [] -> notFound
- p:ps -> defaultLayout $ do
- let mperson = if null ps then Just p else Nothing
- setTitle $ text $ "Vervis > People > " <> ident
- $(widgetFile "person")
+ person <- runDB $ do
+ Entity sid _s <- getBy404 $ UniqueSharerIdent ident
+ Entity _pid p <- getBy404 $ UniquePersonIdent sid
+ return p
+ defaultLayout $ do
+ setTitle $ text $ "Vervis > People > " <> ident
+ $(widgetFile "person")
diff --git a/src/Vervis/Handler/Project.hs b/src/Vervis/Handler/Project.hs
index 6f92769..18c110f 100644
--- a/src/Vervis/Handler/Project.hs
+++ b/src/Vervis/Handler/Project.hs
@@ -72,20 +72,15 @@ getProjectNewR ident = do
getProjectR :: Text -> Text -> Handler Html
getProjectR user proj = do
- projects <- runDB $ select $ from $ \ (sharer, project) -> do
- where_ $
- sharer ^. SharerIdent ==. val user &&.
- project ^. ProjectIdent ==. val proj &&.
- sharer ^. SharerId ==. project ^. ProjectSharer
- return project
- case projects of
- [] -> notFound
- p:ps -> defaultLayout $ do
- let mproject = if null ps then Just p else Nothing
- setTitle $ text $ mconcat
- [ "Vervis > People > "
- , user
- , " > Project > "
- , proj
- ]
- $(widgetFile "project")
+ project <- runDB $ do
+ Entity sid _s <- getBy404 $ UniqueSharerIdent user
+ Entity _pid p <- getBy404 $ UniqueProject proj sid
+ return p
+ defaultLayout $ do
+ setTitle $ text $ mconcat
+ [ "Vervis > People > "
+ , user
+ , " > Project > "
+ , proj
+ ]
+ $(widgetFile "project")
diff --git a/templates/person.hamlet b/templates/person.hamlet
index 1e74c27..0990edb 100644
--- a/templates/person.hamlet
+++ b/templates/person.hamlet
@@ -14,15 +14,11 @@ $#
- This is the user page for #{ident} +
+ This is the user page for #{ident} -
- See - projects. - -$nothing -
Internal error: More than one user with the same identifier! +
+ See
+ projects.
diff --git a/templates/project.hamlet b/templates/project.hamlet
index 1f17e6b..efb48c4 100644
--- a/templates/project.hamlet
+++ b/templates/project.hamlet
@@ -14,26 +14,28 @@ $#
This is the project page for #{proj}, shared by #{user}. +
This is the project page for #{proj}, shared by #{user}. -
Human-friendly name - | - $maybe name <- projectName project - #{name} - $nothing - (none) - | ||||
Description - |
- $maybe desc <- projectDesc project
- #{desc}
- $nothing
- (none)
+Details +
|