From 7af44d693c06b16b95cb718383cc6a7c608309fa Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Thu, 6 Jun 2024 21:36:39 +0300 Subject: [PATCH] S2S: Project: Remove: Child-active: Revoke Grants-for-teams --- src/Vervis/Actor/Project.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Vervis/Actor/Project.hs b/src/Vervis/Actor/Project.hs index e1f61e0..3e26bbc 100644 --- a/src/Vervis/Actor/Project.hs +++ b/src/Vervis/Actor/Project.hs @@ -5060,6 +5060,7 @@ projectRemove now projectID (Verse authorIdMsig body) remove = do -- Grab extension-Grants that I'm about to revoke gathers <- selectList [SourceUsGatherSource ==. sendID] [] leafs <- selectList [SourceUsLeafSource ==. sendID] [] + conveys <- selectList [SourceUsConveySource ==. sendID] [] -- Delete the whole Source record deleteWhere [SourceRemoveSend ==. sendID] @@ -5073,6 +5074,10 @@ projectRemove now projectID (Verse authorIdMsig body) remove = do deleteWhere [SourceUsLeafToLocalLeaf <-. leafIDs] deleteWhere [SourceUsLeafToRemoteLeaf <-. leafIDs] deleteWhere [SourceUsLeafId <-. leafIDs] + let conveyIDs = map entityKey conveys + deleteWhere [SourceUsConveyFromLocalConvey <-. conveyIDs] + deleteWhere [SourceUsConveyFromRemoteConvey <-. conveyIDs] + deleteWhere [SourceUsConveyId <-. conveyIDs] case topic of Left (localID, _, _) -> do deleteWhere [SourceThemDelegateLocalSource ==. localID] @@ -5141,7 +5146,12 @@ projectRemove now projectID (Verse authorIdMsig body) remove = do recip , grantID ) - revokes <- for (revokesG ++ revokesL) $ \ (actor, grantID) -> do + revokesC <- for conveys $ \ (Entity _ (SourceUsConvey _ startID grantID)) -> do + SquadUsStart acceptID _ <- getJust startID + SquadUsAccept squadID _ <- getJust acceptID + team <- bimap snd snd <$> getSquadTeam squadID + return (first LocalActorGroup team, grantID) + revokes <- for (revokesG ++ revokesL ++ revokesC) $ \ (actor, grantID) -> do ext@(actionExt, _, _, _) <- prepareExtRevoke actor grantID let recipByKey = LocalActorProject projectID extID <- insertEmptyOutboxItem' (actorOutbox actorRecip) now