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

UI: Add reopen-this-ticket button to ticket page

This commit is contained in:
Pere Lev 2023-11-05 17:50:55 +02:00
parent ebe676d94b
commit 91ed2c82b5
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
4 changed files with 34 additions and 2 deletions

View file

@ -951,6 +951,7 @@ instance YesodBreadcrumbs App where
TicketNewR d -> ("New Ticket", Just $ DeckR d)
TicketCloseR _ _ -> ("", Nothing)
TicketOpenR _ _ -> ("", Nothing)
TicketFollowR _ _ -> ("", Nothing)
TicketUnfollowR _ _ -> ("", Nothing)
TicketReplyR d t -> ("Reply", Just $ TicketR d t)

View file

@ -27,6 +27,7 @@ module Vervis.Handler.Ticket
, getTicketNewR
, postTicketNewR
, postTicketCloseR
, postTicketOpenR
, postTicketFollowR
, postTicketUnfollowR
@ -520,6 +521,36 @@ postTicketCloseR deckHash taskHash = do
setMessage "Resolve activity sent"
redirect $ TicketR deckHash taskHash
postTicketOpenR :: KeyHashid Deck -> KeyHashid TicketDeck -> Handler ()
postTicketOpenR deckHash taskHash = do
deckID <- decodeKeyHashid404 deckHash
taskID <- decodeKeyHashid404 taskHash
personEntity@(Entity personID person) <- requireAuth
personHash <- encodeKeyHashid personID
encodeRouteHome <- getEncodeRouteHome
let uTicket = encodeRouteHome $ TicketR deckHash taskHash
result <- runExceptT $ do
(maybeSummary, audience, undo) <- C.unresolve personHash uTicket
grantID <- do
maybeItem <- lift $ runDB $ getGrant CollabTopicDeckCollab CollabTopicDeckDeck deckID personID
fromMaybeE maybeItem "You need to be a collaborator in the Deck to reopen tickets"
grantHash <- encodeKeyHashid grantID
let uCap = encodeRouteHome $ DeckOutboxItemR deckHash grantHash
(localRecips, remoteRecips, fwdHosts, action) <-
C.makeServerInput (Just uCap) maybeSummary audience $ AP.UndoActivity undo
let cap =
Left (LocalActorDeck deckID, LocalActorDeck deckHash, grantID)
handleViaActor personID (Just cap) localRecips remoteRecips fwdHosts action
case result of
Left e -> do
setMessage $ toHtml e
redirect $ TicketR deckHash taskHash
Right resolveID -> do
setMessage "Undo activity sent"
redirect $ TicketR deckHash taskHash
postTicketFollowR :: KeyHashid Deck -> KeyHashid TicketDeck -> Handler ()
postTicketFollowR _ = error "Temporarily disabled"

View file

@ -69,7 +69,7 @@ $# .
Status: #
$maybe (closed, closer) <- resolved
Closed on #{showDate closed} by ^{personLinkFedW closer}
$# ^{buttonW POST "Reopen this ticket" (ProjectTicketOpenR deckHash ticketHash)}
^{buttonW POST "Reopen this ticket" (TicketOpenR deckHash ticketHash)}
$nothing
Open
^{buttonW POST "Close this ticket" (TicketCloseR deckHash ticketHash)}

View file

@ -240,7 +240,7 @@
-- /decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/edit TicketEditR GET POST
-- /decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/delete TicketDeleteR POST
/decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/close TicketCloseR POST
-- /decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/open TicketOpenR POST
/decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/open TicketOpenR POST
-- /decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/claim TicketClaimR POST
-- /decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/unclaim TicketUnclaimR POST
-- /decks/#DeckKeyHashid/tickets/#TicketDeckKeyHashid/assign TicketAssignR GET POST