1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-29 00:24:51 +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' <-
case author of
Left (Entity _ tal) -> Left <$> do
Left (Entity _ tal, _) -> Left <$> do
p <- getJust $ ticketAuthorLocalAuthor tal
getJust $ personIdent p
Right (Entity _ tar) -> Right <$> do

View file

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