1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-29 00:14:52 +09:00

In getProjectTicket, return TUP alongside TAL to prove it exists

This commit is contained in:
fr33domlover 2020-05-14 09:09:57 +00:00
parent 036c60171b
commit d29ba23bfb
2 changed files with 9 additions and 5 deletions

View file

@ -287,7 +287,7 @@ getProjectTicketR shar proj ltkhid = do
) )
author' <- author' <-
case author of case author of
Left (Entity _ tal) -> Left <$> do Left (Entity _ tal, _) -> Left <$> do
p <- getJust $ ticketAuthorLocalAuthor tal p <- getJust $ ticketAuthorLocalAuthor tal
getJust $ personIdent p getJust $ personIdent p
Right (Entity _ tar) -> Right <$> do Right (Entity _ tar) -> Right <$> do

View file

@ -497,7 +497,9 @@ getProjectTicket
, Entity Ticket , Entity Ticket
, Entity LocalTicket , Entity LocalTicket
, Entity TicketProjectLocal , Entity TicketProjectLocal
, Either (Entity TicketAuthorLocal) (Entity TicketAuthorRemote) , Either
(Entity TicketAuthorLocal, Entity TicketUnderProject)
(Entity TicketAuthorRemote)
) )
) )
getProjectTicket shr prj ltid = runMaybeT $ do getProjectTicket shr prj ltid = runMaybeT $ do
@ -513,10 +515,10 @@ getProjectTicket shr prj ltid = runMaybeT $ do
(do mtal <- lift $ getBy $ UniqueTicketAuthorLocal ltid (do mtal <- lift $ getBy $ UniqueTicketAuthorLocal ltid
for mtal $ \ tal@(Entity talid _) -> do for mtal $ \ tal@(Entity talid _) -> do
tupid1 <- MaybeT $ getKeyBy $ UniqueTicketUnderProjectProject tplid tupid1 <- MaybeT $ getKeyBy $ UniqueTicketUnderProjectProject tplid
tupid2 <- MaybeT $ getKeyBy $ UniqueTicketUnderProjectAuthor talid tup@(Entity tupid2 _) <- MaybeT $ getBy $ UniqueTicketUnderProjectAuthor talid
unless (tupid1 == tupid2) $ unless (tupid1 == tupid2) $
error "TAL and TPL used by different TUPs!" error "TAL and TPL used by different TUPs!"
return tal return (tal, tup)
) )
(lift $ getBy $ UniqueTicketAuthorRemote tplid) (lift $ getBy $ UniqueTicketAuthorRemote tplid)
"Ticket doesn't have author" "Ticket doesn't have author"
@ -533,7 +535,9 @@ getProjectTicket404
, Entity Ticket , Entity Ticket
, Entity LocalTicket , Entity LocalTicket
, Entity TicketProjectLocal , Entity TicketProjectLocal
, Either (Entity TicketAuthorLocal) (Entity TicketAuthorRemote) , Either
(Entity TicketAuthorLocal, Entity TicketUnderProject)
(Entity TicketAuthorRemote)
) )
getProjectTicket404 shr prj ltkhid = do getProjectTicket404 shr prj ltkhid = do
ltid <- decodeKeyHashid404 ltkhid ltid <- decodeKeyHashid404 ltkhid