From c5996bd226a1e4274e1fc333e94ff66050e3b155 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 3 Feb 2020 15:10:13 +0000 Subject: [PATCH] Re-enable UI for removing ticket deps --- src/Vervis/Handler/Ticket.hs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index fd645d2..684c5d8 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -988,27 +988,30 @@ getTicketDepNewR shr prj tkhid = do defaultLayout $(widgetFile "ticket/dep/new") postTicketDepOldR :: ShrIdent -> PrjIdent -> KeyHashid Ticket -> KeyHashid Ticket -> Handler Html -postTicketDepOldR shr prj pnum cnum = error "Disabled for now" - {- +postTicketDepOldR shr prj pnum cnum = do mmethod <- lookupPostParam "_method" case mmethod of Just "DELETE" -> deleteTicketDepOldR shr prj pnum cnum _ -> notFound - -} deleteTicketDepOldR :: ShrIdent -> PrjIdent -> KeyHashid Ticket -> KeyHashid Ticket -> Handler Html -deleteTicketDepOldR shr prj pnum cnum = error "Disabled for now" - {- +deleteTicketDepOldR shr prj pnum cnum = do runDB $ do Entity sid _ <- getBy404 $ UniqueSharer shr Entity jid _ <- getBy404 $ UniqueProject prj sid - Entity ptid _ <- getBy404 $ UniqueTicket jid pnum - Entity ctid _ <- getBy404 $ UniqueTicket jid cnum + + ptid <- decodeKeyHashid404 pnum + pt <- get404 ptid + unless (ticketProject pt == jid) notFound + + ctid <- decodeKeyHashid404 cnum + ct <- get404 ctid + unless (ticketProject ct == jid) notFound + Entity tdid _ <- getBy404 $ UniqueTicketDependency ptid ctid delete tdid setMessage "Ticket dependency removed." redirect $ TicketDepsR shr prj pnum - -} getTicketReverseDepsR :: ShrIdent -> PrjIdent -> KeyHashid Ticket -> Handler TypedContent