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

S2S: repoCreateTicketF: Store a Patch record in DB, to have a local copy

This commit is contained in:
fr33domlover 2020-07-21 10:03:51 +00:00
parent 029fce58a4
commit fd8405e741

View file

@ -788,7 +788,7 @@ insertRemoteTicket
-> TextPandocMarkdown
-> RemoteActivityId
-> OutboxItemId
-> ReaderT SqlBackend m (Either Bool ())
-> ReaderT SqlBackend m (Either Bool TicketId)
insertRemoteTicket mktxl author luTicket published summary content source ractidCreate obiidAccept = do
tid <- insert Ticket
{ ticketNumber = Nothing
@ -840,7 +840,7 @@ insertRemoteTicket mktxl author luTicket published summary content source ractid
delete tclid
delete tid
return $ Left True
Just _rtid -> return $ Right ()
Just _rtid -> return $ Right tid
insertAcceptOnCreate collections outboxItemRoute actorRoute author luCreate tlocal obiidAccept = do
encodeRouteLocal <- getEncodeRouteLocal
@ -919,7 +919,7 @@ projectCreateTicketF now shrRecip prjRecip author body mfwd luCreate ticket muTa
let makeTPL tclid = TicketProjectLocal tclid jid
result <- insertRemoteTicket makeTPL author (AP.ticketId tlocal) published title desc src ractid obiidAccept
unless (isRight result) $ delete obiidAccept
for result $ \ () -> do
for result $ \ _tid -> do
mremotesHttpFwd <- for mfwd $ \ (localRecips, sig) -> do
let sieve =
makeRecipientSet
@ -982,7 +982,7 @@ repoCreateTicketF
repoCreateTicketF now shrRecip rpRecip author body mfwd luCreate ticket muTarget = do
ParsedCreateTicket targetAndContext tlocal published title desc src <-
checkCreateTicket author ticket muTarget
mmhttp <- for (targetRelevance targetAndContext) $ \ (mb, vcs, _diff) -> runDBExcept $ do
mmhttp <- for (targetRelevance targetAndContext) $ \ (mb, vcs, diff) -> runDBExcept $ do
Entity rid r <- lift $ do
sid <- getKeyBy404 $ UniqueSharer shrRecip
getBy404 $ UniqueRepo rpRecip sid
@ -993,7 +993,8 @@ repoCreateTicketF now shrRecip rpRecip author body mfwd luCreate ticket muTarget
let mkTRL tclid = TicketRepoLocal tclid rid mb
result <- insertRemoteTicket mkTRL author (AP.ticketId tlocal) published title desc src ractid obiidAccept
unless (isRight result) $ delete obiidAccept
for result $ \ () -> do
for result $ \ tid -> do
insert_ $ Patch tid published diff
mremotesHttpFwd <- for mfwd $ \ (localRecips, sig) -> do
let sieve =
makeRecipientSet