Ticket claim requests in DB and personal list view of them
This commit is contained in:
parent
ae83a5f3ad
commit
5e04f951f2
6 changed files with 73 additions and 0 deletions
|
@ -132,6 +132,14 @@ Ticket
|
|||
|
||||
UniqueTicket project number
|
||||
|
||||
TicketClaimRequest
|
||||
person PersonId
|
||||
ticket TicketId
|
||||
message Text
|
||||
created UTCTime
|
||||
|
||||
UniqueTicketClaimRequest person ticket
|
||||
|
||||
Discussion
|
||||
nextMessage Int
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
/k/!new KeyNewR GET
|
||||
/k/#KyIdent KeyR GET DELETE POST
|
||||
|
||||
/cr ClaimRequestsR GET
|
||||
|
||||
/s/#ShrIdent/rr RepoRolesR GET POST
|
||||
/s/#ShrIdent/rr/!new RepoRoleNewR GET
|
||||
/s/#ShrIdent/rr/#RlIdent RepoRoleR GET DELETE POST
|
||||
|
|
|
@ -130,6 +130,8 @@ instance Yesod App where
|
|||
(KeyR _key , _ ) -> personAny
|
||||
(KeyNewR , _ ) -> personAny
|
||||
|
||||
(ClaimRequestsR , _ ) -> personAny
|
||||
|
||||
(RepoRolesR shr , _ ) -> personOrGroupAdmin shr
|
||||
(RepoRoleNewR shr , _ ) -> personOrGroupAdmin shr
|
||||
(RepoRoleR shr _rl , _ ) -> personOrGroupAdmin shr
|
||||
|
@ -366,6 +368,10 @@ instance YesodBreadcrumbs App where
|
|||
KeyNewR -> ("New", Just KeysR)
|
||||
KeyR key -> (ky2text key, Just KeysR)
|
||||
|
||||
ClaimRequestsR -> ( "Ticket Claim Requests"
|
||||
, Just HomeR
|
||||
)
|
||||
|
||||
RepoRolesR shr -> ("Repo Roles", Just $ SharerR shr)
|
||||
RepoRoleNewR shr -> ("New", Just $ RepoRolesR shr)
|
||||
RepoRoleR shr rl -> (rl2text rl, Just $ RepoRolesR shr)
|
||||
|
|
|
@ -29,6 +29,7 @@ module Vervis.Handler.Ticket
|
|||
, getTicketAssignR
|
||||
, postTicketAssignR
|
||||
, postTicketUnassignR
|
||||
, getClaimRequestsR
|
||||
, getTicketDiscussionR
|
||||
, postTicketDiscussionR
|
||||
, getTicketMessageR
|
||||
|
@ -385,6 +386,25 @@ postTicketUnassignR shr prj num = do
|
|||
setMessage $ fromMaybe "The ticket is now unassigned." mmsg
|
||||
redirect $ TicketR shr prj num
|
||||
|
||||
getClaimRequestsR :: Handler Html
|
||||
getClaimRequestsR = do
|
||||
pid <- requireAuthId
|
||||
rqs <- runDB $ select $ from $
|
||||
\ (tcr `InnerJoin` ticket `InnerJoin` project `InnerJoin` sharer) -> do
|
||||
on $ project ^. ProjectSharer E.==. sharer ^. SharerId
|
||||
on $ ticket ^. TicketProject E.==. project ^. ProjectId
|
||||
on $ tcr ^. TicketClaimRequestTicket E.==. ticket ^. TicketId
|
||||
where_ $ tcr ^. TicketClaimRequestPerson E.==. val pid
|
||||
orderBy [desc $ tcr ^. TicketClaimRequestCreated]
|
||||
return
|
||||
( sharer ^. SharerIdent
|
||||
, project ^. ProjectIdent
|
||||
, ticket ^. TicketNumber
|
||||
, ticket ^. TicketTitle
|
||||
, tcr ^. TicketClaimRequestCreated
|
||||
)
|
||||
defaultLayout $(widgetFile "person/claim-requests")
|
||||
|
||||
selectDiscussionId :: ShrIdent -> PrjIdent -> Int -> AppDB DiscussionId
|
||||
selectDiscussionId shar proj tnum = do
|
||||
Entity sid _sharer <- getBy404 $ UniqueSharer shar
|
||||
|
|
32
templates/person/claim-requests.hamlet
Normal file
32
templates/person/claim-requests.hamlet
Normal file
|
@ -0,0 +1,32 @@
|
|||
$# 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>Project
|
||||
<th>#
|
||||
<th>Title
|
||||
<th>Created on
|
||||
$forall (Value shr, Value prj, Value num, Value title, Value time) <- rqs
|
||||
<tr>
|
||||
<td>
|
||||
<a href=@{SharerR shr}>#{shr2text shr}
|
||||
/
|
||||
<a href=@{ProjectR shr prj}>#{prj2text prj}
|
||||
<td>
|
||||
<a href=@{TicketR shr prj num}>#{num}
|
||||
<td>
|
||||
<a href=@{TicketR shr prj num}>#{title}
|
||||
<td>
|
||||
#{showDate time}
|
|
@ -40,3 +40,8 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|||
|
||||
<p>
|
||||
<a href=@{ProjectRolesR ident}>Project roles
|
||||
|
||||
<h2>Ticket claim requests
|
||||
|
||||
<p>
|
||||
<a href=@{ClaimRequestsR}>Ticket claim requests
|
||||
|
|
Loading…
Reference in a new issue