S2S: Person: Trivial Resolve handler

This commit is contained in:
Pere Lev 2023-11-05 12:52:16 +02:00
parent 35eb4917a1
commit 222ba823c1
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D

View file

@ -112,6 +112,32 @@ personOffer now recipPersonID (Verse authorIdMsig body) (AP.Offer object uTarget
Nothing -> done "I already have this activity in my inbox"
Just _actorID -> done "Inserted this Offer to my inbox"
-- Meaning: Someone has asked to resolve a ticket/MR
-- Behavior:
-- * Insert to my inbox
personResolve
:: UTCTime
-> PersonId
-> Verse
-> AP.Resolve URIMode
-> ActE (Text, Act (), Next)
personResolve now recipPersonID (Verse authorIdMsig body) (AP.Resolve uObject) = do
maybeNew <- withDBExcept $ do
-- Grab me from DB
(personRecip, actorRecip) <- lift $ do
p <- getJust recipPersonID
(p,) <$> getJust (personActor p)
maybeResolveDB <- lift $ insertToInbox now authorIdMsig body (actorInbox actorRecip) True
for maybeResolveDB $ \ _resolveDB ->
return $ personActor personRecip
case maybeNew of
Nothing -> done "I already have this activity in my inbox"
Just _actorID -> done "Inserted this Resolve to my inbox"
------------------------------------------------------------------------------
-- Following
------------------------------------------------------------------------------
@ -725,6 +751,7 @@ personBehavior now personID (Left verse@(Verse _authorIdMsig body)) =
AP.OfferActivity offer -> personOffer now personID verse offer
AP.RejectActivity reject -> personReject now personID verse reject
AP.RemoveActivity remove -> personRemove now personID verse remove
AP.ResolveActivity resolve -> personResolve now personID verse resolve
AP.RevokeActivity revoke -> personRevoke now personID verse revoke
AP.UndoActivity undo -> personUndo now personID verse undo
_ -> throwE "Unsupported activity type for Person"