Per-project list of ticket claim requests

This commit is contained in:
fr33domlover 2016-06-07 15:29:26 +00:00
parent 574b47a72a
commit 047b9c00c9
5 changed files with 98 additions and 34 deletions

View file

@ -68,43 +68,44 @@
-- Projects -- Projects
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
/s/#ShrIdent/r ReposR GET POST /s/#ShrIdent/r ReposR GET POST
/s/#ShrIdent/r/!new RepoNewR GET /s/#ShrIdent/r/!new RepoNewR GET
/s/#ShrIdent/r/#RpIdent RepoR GET PUT DELETE POST /s/#ShrIdent/r/#RpIdent RepoR GET PUT DELETE POST
/s/#ShrIdent/r/#RpIdent/edit RepoEditR GET /s/#ShrIdent/r/#RpIdent/edit RepoEditR GET
/s/#ShrIdent/r/#RpIdent/s/+Texts RepoSourceR GET /s/#ShrIdent/r/#RpIdent/s/+Texts RepoSourceR GET
/s/#ShrIdent/r/#RpIdent/c RepoHeadChangesR GET /s/#ShrIdent/r/#RpIdent/c RepoHeadChangesR GET
/s/#ShrIdent/r/#RpIdent/c/#Text RepoChangesR GET /s/#ShrIdent/r/#RpIdent/c/#Text RepoChangesR GET
/s/#ShrIdent/r/#RpIdent/d RepoDevsR GET POST /s/#ShrIdent/r/#RpIdent/d RepoDevsR GET POST
/s/#ShrIdent/r/#RpIdent/d/!new RepoDevNewR GET /s/#ShrIdent/r/#RpIdent/d/!new RepoDevNewR GET
/s/#ShrIdent/r/#RpIdent/d/#ShrIdent RepoDevR GET DELETE POST /s/#ShrIdent/r/#RpIdent/d/#ShrIdent RepoDevR GET DELETE POST
/s/#ShrIdent/r/#RpIdent/_darcs/+Texts DarcsDownloadR GET /s/#ShrIdent/r/#RpIdent/_darcs/+Texts DarcsDownloadR GET
/s/#ShrIdent/r/#RpIdent/git/info/refs GitRefDiscoverR GET /s/#ShrIdent/r/#RpIdent/git/info/refs GitRefDiscoverR GET
--/s/#ShrIdent/r/#RpIdent/git/git-upload-pack GitUploadRequestR POST --/s/#ShrIdent/r/#RpIdent/git/git-upload-pack GitUploadRequestR POST
/s/#ShrIdent/p ProjectsR GET POST /s/#ShrIdent/p ProjectsR GET POST
/s/#ShrIdent/p/!new ProjectNewR GET /s/#ShrIdent/p/!new ProjectNewR GET
/s/#ShrIdent/p/#PrjIdent ProjectR GET PUT POST /s/#ShrIdent/p/#PrjIdent ProjectR GET PUT POST
/s/#ShrIdent/p/#PrjIdent/edit ProjectEditR GET /s/#ShrIdent/p/#PrjIdent/edit ProjectEditR GET
/s/#ShrIdent/p/#PrjIdent/d ProjectDevsR GET POST /s/#ShrIdent/p/#PrjIdent/d ProjectDevsR GET POST
/s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET /s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET
/s/#ShrIdent/p/#PrjIdent/d/#ShrIdent ProjectDevR GET DELETE POST /s/#ShrIdent/p/#PrjIdent/d/#ShrIdent ProjectDevR GET DELETE POST
/s/#ShrIdent/p/#PrjIdent/t TicketsR GET POST /s/#ShrIdent/p/#PrjIdent/t TicketsR GET POST
/s/#ShrIdent/p/#PrjIdent/t/!new TicketNewR GET /s/#ShrIdent/p/#PrjIdent/t/!new TicketNewR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int TicketR GET PUT DELETE POST /s/#ShrIdent/p/#PrjIdent/t/#Int TicketR GET PUT DELETE POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/edit TicketEditR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/edit TicketEditR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/close TicketCloseR POST /s/#ShrIdent/p/#PrjIdent/t/#Int/close TicketCloseR POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/open TicketOpenR POST /s/#ShrIdent/p/#PrjIdent/t/#Int/open TicketOpenR POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/claim TicketClaimR POST /s/#ShrIdent/p/#PrjIdent/t/#Int/claim TicketClaimR POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/unclaim TicketUnclaimR POST /s/#ShrIdent/p/#PrjIdent/t/#Int/unclaim TicketUnclaimR POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/assign TicketAssignR GET POST /s/#ShrIdent/p/#PrjIdent/t/#Int/assign TicketAssignR GET POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/unassign TicketUnassignR POST /s/#ShrIdent/p/#PrjIdent/t/#Int/unassign TicketUnassignR POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/d TicketDiscussionR GET POST /s/#ShrIdent/p/#PrjIdent/tcr TicketClaimRequestsR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int TicketMessageR GET POST /s/#ShrIdent/p/#PrjIdent/t/#Int/d TicketDiscussionR GET POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int TicketMessageR GET POST
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET
/s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET /s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET

View file

@ -454,6 +454,9 @@ instance YesodBreadcrumbs App where
, Just $ TicketR shr prj num , Just $ TicketR shr prj num
) )
TicketUnassignR _shr _prj _num -> ("", Nothing) TicketUnassignR _shr _prj _num -> ("", Nothing)
TicketClaimRequestsR shr prj -> ( "Ticket Claim Requests"
, Just $ ProjectR shr prj
)
TicketDiscussionR shar proj num -> ( "Discussion" TicketDiscussionR shar proj num -> ( "Discussion"
, Just $ TicketR shar proj num , Just $ TicketR shar proj num
) )

View file

@ -30,6 +30,7 @@ module Vervis.Handler.Ticket
, postTicketAssignR , postTicketAssignR
, postTicketUnassignR , postTicketUnassignR
, getClaimRequestsR , getClaimRequestsR
, getTicketClaimRequestsR
, getTicketDiscussionR , getTicketDiscussionR
, postTicketDiscussionR , postTicketDiscussionR
, getTicketMessageR , getTicketMessageR
@ -386,6 +387,8 @@ postTicketUnassignR shr prj num = do
setMessage $ fromMaybe "The ticket is now unassigned." mmsg setMessage $ fromMaybe "The ticket is now unassigned." mmsg
redirect $ TicketR shr prj num redirect $ TicketR shr prj num
-- | The logged-in user gets a list of the ticket claim requests they have
-- opened, in any project.
getClaimRequestsR :: Handler Html getClaimRequestsR :: Handler Html
getClaimRequestsR = do getClaimRequestsR = do
pid <- requireAuthId pid <- requireAuthId
@ -405,6 +408,31 @@ getClaimRequestsR = do
) )
defaultLayout $(widgetFile "person/claim-requests") defaultLayout $(widgetFile "person/claim-requests")
-- | Get a list of ticket claim requests for a given project.
getTicketClaimRequestsR :: ShrIdent -> PrjIdent -> Handler Html
getTicketClaimRequestsR shr prj = do
rqs <- runDB $ do
Entity sid _ <- getBy404 $ UniqueSharer shr
Entity jid _ <- getBy404 $ UniqueProject prj sid
select $ from $
\ ( tcr `InnerJoin`
ticket `InnerJoin`
person `InnerJoin`
sharer
) -> do
on $ person ^. PersonIdent E.==. sharer ^. SharerId
on $ tcr ^. TicketClaimRequestPerson E.==. person ^. PersonId
on $ tcr ^. TicketClaimRequestTicket E.==. ticket ^. TicketId
where_ $ ticket ^. TicketProject E.==. val jid
orderBy [desc $ tcr ^. TicketClaimRequestCreated]
return
( sharer
, ticket ^. TicketNumber
, ticket ^. TicketTitle
, tcr ^. TicketClaimRequestCreated
)
defaultLayout $(widgetFile "ticket/claim-request/list")
selectDiscussionId :: ShrIdent -> PrjIdent -> Int -> AppDB DiscussionId selectDiscussionId :: ShrIdent -> PrjIdent -> Int -> AppDB DiscussionId
selectDiscussionId shar proj tnum = do selectDiscussionId shar proj tnum = do
Entity sid _sharer <- getBy404 $ UniqueSharer shar Entity sid _sharer <- getBy404 $ UniqueSharer shar

View file

@ -26,6 +26,8 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
Description: #{fromMaybe "(none)" $ projectDesc project} Description: #{fromMaybe "(none)" $ projectDesc project}
<li> <li>
<a href=@{TicketsR shar proj}>Tickets <a href=@{TicketsR shar proj}>Tickets
<li>
<a href=@{TicketClaimRequestsR shar proj}>Ticket claim requests
<h2>Collaborators <h2>Collaborators

View file

@ -0,0 +1,30 @@
$# This file is part of Vervis.
$#
$# Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#
$# The author(s) have dedicated all copyright and related and neighboring
$# rights to this software to the public domain worldwide. This software is
$# distributed without any warranty.
$#
$# You should have received a copy of the CC0 Public Domain Dedication along
$# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
<table>
<tr>
<th>Opened on
<th>Opened by
<th>#
<th>Title
$forall (Entity _ sharer, Value num, Value title, Value time) <- rqs
<tr>
<td>
#{showDate time}
<td>
^{personLinkW sharer}
<td>
<a href=@{TicketR shr prj num}>#{num}
<td>
<a href=@{TicketR shr prj num}>#{title}