diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index dd1f294..b74b9bb 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -49,7 +49,7 @@ import Data.Traversable (for) import Database.Esqueleto hiding ((==.), (=.), (+=.), update) import Database.Persist import Text.Blaze.Html (Html, toHtml) -import Yesod.Auth (requireAuthId) +import Yesod.Auth (requireAuthId, maybeAuthId) import Yesod.Core (defaultLayout) import Yesod.Core.Handler (setMessage, redirect, lookupPostParam, notFound) import Yesod.Form.Functions (runFormGet, runFormPost) @@ -143,7 +143,7 @@ getTicketNewR shar proj = do getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html getTicketR shar proj num = do - pid <- requireAuthId + mpid <- maybeAuthId (author, massignee, closer, ticket) <- runDB $ do ticket <- do Entity s _ <- getBy404 $ UniqueSharer shar @@ -156,7 +156,7 @@ getTicketR shar proj num = do massignee <- for (ticketAssignee ticket) $ \ apid -> do person <- get404 apid sharer <- get404 $ personIdent person - return (sharer, apid == pid) + return (sharer, fromMaybe False $ (== apid) <$> mpid) closer <- if ticketDone ticket then do