module Test.FeatureFlags.SearchVisibilityAvailable where
import qualified API.Galley as Public
import qualified API.GalleyInternal as Internal
import SetupHelpers
import Test.FeatureFlags.Util
import Testlib.Prelude
testPatchSearchVisibility :: (HasCallStack) => App ()
testPatchSearchVisibility :: HasCallStack => App ()
testPatchSearchVisibility = Domain -> String -> Value -> App ()
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> String -> Value -> App ()
checkPatch Domain
OwnDomain String
"searchVisibility" Value
enabled
testSearchVisibilityDisabledByDefault :: (HasCallStack) => App ()
testSearchVisibilityDisabledByDefault :: HasCallStack => App ()
testSearchVisibilityDisabledByDefault = do
ServiceOverrides -> (HasCallStack => String -> App ()) -> App ()
forall a.
HasCallStack =>
ServiceOverrides -> (HasCallStack => String -> App a) -> App a
withModifiedBackend ServiceOverrides
forall a. Default a => a
def {galleyCfg = setField "settings.featureFlags.teamSearchVisibility" "disabled-by-default"} ((HasCallStack => String -> App ()) -> App ())
-> (HasCallStack => String -> App ()) -> App ()
forall a b. (a -> b) -> a -> b
$ \String
domain -> do
(owner, tid, m : _) <- String -> Int -> App (Value, String, [Value])
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> Int -> App (Value, String, [Value])
createTeam String
domain Int
2
checkFeature "searchVisibility" m tid disabled
assertSuccess =<< Internal.setTeamFeatureStatus owner tid "searchVisibility" "enabled"
checkFeature "searchVisibility" owner tid enabled
assertSuccess =<< Internal.setTeamFeatureStatus owner tid "searchVisibility" "disabled"
checkFeature "searchVisibility" owner tid disabled
testSearchVisibilityEnabledByDefault :: (HasCallStack) => App ()
testSearchVisibilityEnabledByDefault :: HasCallStack => App ()
testSearchVisibilityEnabledByDefault = do
ServiceOverrides -> (HasCallStack => String -> App ()) -> App ()
forall a.
HasCallStack =>
ServiceOverrides -> (HasCallStack => String -> App a) -> App a
withModifiedBackend ServiceOverrides
forall a. Default a => a
def {galleyCfg = setField "settings.featureFlags.teamSearchVisibility" "enabled-by-default"} ((HasCallStack => String -> App ()) -> App ())
-> (HasCallStack => String -> App ()) -> App ()
forall a b. (a -> b) -> a -> b
$ \String
domain -> do
(owner, tid, m : _) <- String -> Int -> App (Value, String, [Value])
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> Int -> App (Value, String, [Value])
createTeam String
domain Int
2
nonMember <- randomUser domain def
assertForbidden =<< Public.getTeamFeature nonMember tid "searchVisibility"
checkFeature "searchVisibility" m tid enabled
assertSuccess =<< Internal.setTeamFeatureStatus owner tid "searchVisibility" "disabled"
checkFeature "searchVisibility" owner tid disabled
assertSuccess =<< Internal.setTeamFeatureStatus owner tid "searchVisibility" "enabled"
checkFeature "searchVisibility" owner tid enabled