diff --git a/src/Vervis/Actor/Person.hs b/src/Vervis/Actor/Person.hs index aba6886..b815b41 100644 --- a/src/Vervis/Actor/Person.hs +++ b/src/Vervis/Actor/Person.hs @@ -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"