Fix: Used requireAuthId in public page

This commit is contained in:
fr33domlover 2016-06-06 10:00:05 +00:00
parent a3af63d368
commit 505585d8b8

View file

@ -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