From d5d6b0af617f31fc88f57e3f6a8b554bce6c5d30 Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Sat, 10 Jun 2023 10:56:02 +0300 Subject: [PATCH] On app start, launch only verified Persons --- src/Vervis/Application.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Vervis/Application.hs b/src/Vervis/Application.hs index 86072d9..31e0d63 100644 --- a/src/Vervis/Application.hs +++ b/src/Vervis/Application.hs @@ -344,7 +344,7 @@ makeFoundation appSettings = do loadTheater :: Env -> WorkerDB [(LocalActorBy Key, Env, Verse -> Act (Either Text Text, Act (), Next))] loadTheater env = concat <$> sequenceA - [ selectAll LocalActorPerson + [ selectAllWhere LocalActorPerson (PersonVerified ==. True) , selectAll LocalActorGroup , selectAll LocalActorRepo , selectAll LocalActorDeck @@ -358,6 +358,14 @@ makeFoundation appSettings = do selectAll makeLocalActor = map (\ xid -> (makeLocalActor xid, env, behave actorBehavior xid)) <$> selectKeysList [] [] + selectAllWhere + :: (PersistRecordBackend a SqlBackend, VervisActor a) + => (Key a -> LocalActorBy Key) + -> Filter a + -> WorkerDB [(LocalActorBy Key, Env, Verse -> Act (Either Text Text, Act (), Next))] + selectAllWhere makeLocalActor filt = + map (\ xid -> (makeLocalActor xid, env, behave actorBehavior xid)) <$> + selectKeysList [filt] [] startPersonLauncher :: Theater -> Env -> IO (MVar (PersonId, MVar Bool)) startPersonLauncher theater env = do