diff --git a/changelog.d/5-internal/delete-multi-get b/changelog.d/5-internal/delete-multi-get new file mode 100644 index 00000000000..44c57b02853 --- /dev/null +++ b/changelog.d/5-internal/delete-multi-get @@ -0,0 +1 @@ +galley: Delete unused endpoint for getting feature status for multiple teams \ No newline at end of file diff --git a/integration/test/Test/FeatureFlags/SearchVisibilityInbound.hs b/integration/test/Test/FeatureFlags/SearchVisibilityInbound.hs index 55d40c5c2f7..c1ef7a5d3ca 100644 --- a/integration/test/Test/FeatureFlags/SearchVisibilityInbound.hs +++ b/integration/test/Test/FeatureFlags/SearchVisibilityInbound.hs @@ -1,24 +1,10 @@ module Test.FeatureFlags.SearchVisibilityInbound where import qualified API.Galley as Public -import qualified API.GalleyInternal as Internal import SetupHelpers import Test.FeatureFlags.Util import Testlib.Prelude -testFeatureNoConfigMultiSearchVisibilityInbound :: (HasCallStack) => App () -testFeatureNoConfigMultiSearchVisibilityInbound = do - (_owner1, team1, _) <- createTeam OwnDomain 0 - (_owner2, team2, _) <- createTeam OwnDomain 0 - - assertSuccess =<< Internal.setTeamFeatureStatus OwnDomain team2 "searchVisibilityInbound" "enabled" - - response <- Internal.getFeatureStatusMulti OwnDomain "searchVisibilityInbound" [team1, team2] - - statuses <- response.json %. "default_status" >>= asList - length statuses `shouldMatchInt` 2 - statuses `shouldMatchSet` [object ["team" .= team1, "status" .= "disabled"], object ["team" .= team2, "status" .= "enabled"]] - testSearchVisibilityInboundInternal :: (HasCallStack) => APIAccess -> App () testSearchVisibilityInboundInternal access = do let featureName = "searchVisibilityInbound" diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs index bdae90491ca..5ea262e42cb 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs @@ -39,7 +39,6 @@ import Wire.API.Provider.Service (ServiceRef) import Wire.API.Routes.Features import Wire.API.Routes.Internal.Brig.EJPD import Wire.API.Routes.Internal.Galley.ConversationsIntra -import Wire.API.Routes.Internal.Galley.TeamFeatureNoConfigMulti import Wire.API.Routes.Internal.Galley.TeamsIntra import Wire.API.Routes.MultiVerb import Wire.API.Routes.Named @@ -82,8 +81,6 @@ type IFeatureAPI = :<|> IFeatureStatusLockStatusPut MlsE2EIdConfig :<|> IFeatureStatusLockStatusPut MlsMigrationConfig :<|> IFeatureStatusLockStatusPut EnforceFileDownloadLocationConfig - -- special endpoints - :<|> IFeatureNoConfigMultiGet SearchVisibilityInboundConfig -- all feature configs :<|> Named "feature-configs-internal" @@ -359,19 +356,6 @@ type IFeatureStatusLockStatusPut cfg = :> Put '[JSON] LockStatusResponse ) -type FeatureNoConfigMultiGetBase featureName = - Summary - (AppendSymbol "Get team feature status in bulk for feature " (FeatureSymbol featureName)) - :> "features-multi-teams" - :> FeatureSymbol featureName - :> ReqBody '[JSON] TeamFeatureNoConfigMultiRequest - :> Post '[JSON] (TeamFeatureNoConfigMultiResponse featureName) - -type IFeatureNoConfigMultiGet f = - Named - '("igetmulti", f) - (FeatureNoConfigMultiGetBase f) - type IFederationAPI = Named "get-federation-status" diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs index 9f96c0b024c..8bb68c6eb38 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/Galley/TeamFeatureNoConfigMulti.hs @@ -16,9 +16,7 @@ -- with this program. If not, see . module Wire.API.Routes.Internal.Galley.TeamFeatureNoConfigMulti - ( TeamFeatureNoConfigMultiRequest (..), - TeamFeatureNoConfigMultiResponse (..), - TeamStatus (..), + ( TeamStatus (..), ) where @@ -29,30 +27,6 @@ import Data.Schema import Imports import Wire.API.Team.Feature qualified as Public -newtype TeamFeatureNoConfigMultiRequest = TeamFeatureNoConfigMultiRequest - { teams :: [TeamId] - } - deriving (Show, Eq) - deriving (A.ToJSON, A.FromJSON, S.ToSchema) via Schema TeamFeatureNoConfigMultiRequest - -instance ToSchema TeamFeatureNoConfigMultiRequest where - schema = - object "TeamFeatureNoConfigMultiRequest" $ - TeamFeatureNoConfigMultiRequest - <$> teams .= field "teams" (array schema) - -newtype TeamFeatureNoConfigMultiResponse cfg = TeamFeatureNoConfigMultiResponse - { teamsStatuses :: [TeamStatus cfg] - } - deriving (Show, Eq) - deriving (A.ToJSON, A.FromJSON, S.ToSchema) via Schema (TeamFeatureNoConfigMultiResponse cfg) - -instance ToSchema (TeamFeatureNoConfigMultiResponse cfg) where - schema = - object "TeamFeatureNoConfigMultiResponse" $ - TeamFeatureNoConfigMultiResponse - <$> teamsStatuses .= field "default_status" (array schema) - data TeamStatus cfg = TeamStatus { team :: TeamId, status :: Public.FeatureStatus diff --git a/services/galley/src/Galley/API/Internal.hs b/services/galley/src/Galley/API/Internal.hs index 411ad8fe295..eecc5ad3031 100644 --- a/services/galley/src/Galley/API/Internal.hs +++ b/services/galley/src/Galley/API/Internal.hs @@ -284,8 +284,6 @@ featureAPI = <@> mkNamedAPI @'("ilock", MlsE2EIdConfig) (updateLockStatus @MlsE2EIdConfig) <@> mkNamedAPI @'("ilock", MlsMigrationConfig) (updateLockStatus @MlsMigrationConfig) <@> mkNamedAPI @'("ilock", EnforceFileDownloadLocationConfig) (updateLockStatus @EnforceFileDownloadLocationConfig) - -- special endpoints - <@> mkNamedAPI @'("igetmulti", SearchVisibilityInboundConfig) getFeatureMulti -- all features <@> mkNamedAPI @"feature-configs-internal" (maybe getAllTeamFeaturesForServer getAllTeamFeaturesForUser) diff --git a/services/galley/src/Galley/API/Teams/Features.hs b/services/galley/src/Galley/API/Teams/Features.hs index 01edafee051..53a5eb888d8 100644 --- a/services/galley/src/Galley/API/Teams/Features.hs +++ b/services/galley/src/Galley/API/Teams/Features.hs @@ -18,8 +18,7 @@ -- with this program. If not, see . module Galley.API.Teams.Features - ( getFeatureMulti, - setFeature, + ( setFeature, setFeatureInternal, patchFeatureInternal, getAllTeamFeaturesForTeam, diff --git a/services/galley/src/Galley/API/Teams/Features/Get.hs b/services/galley/src/Galley/API/Teams/Features/Get.hs index d57e8d5dfb9..9ad936175ae 100644 --- a/services/galley/src/Galley/API/Teams/Features/Get.hs +++ b/services/galley/src/Galley/API/Teams/Features/Get.hs @@ -21,7 +21,6 @@ module Galley.API.Teams.Features.Get ( getFeature, getFeatureInternal, - getFeatureMulti, getAllTeamFeaturesForServer, getAllTeamFeaturesForTeam, getAllTeamFeaturesForUser, @@ -142,20 +141,6 @@ getFeatureInternal tid = do assertTeamExists tid getFeatureForTeam tid -getFeatureMulti :: - forall cfg r. - ( GetFeatureConfig cfg, - ComputeFeatureConstraints cfg r, - Member (Input Opts) r, - Member TeamFeatureStore r - ) => - Multi.TeamFeatureNoConfigMultiRequest -> - Sem r (Multi.TeamFeatureNoConfigMultiResponse cfg) -getFeatureMulti (Multi.TeamFeatureNoConfigMultiRequest tids) = do - cfgs <- getFeatureForMultiTeam @cfg tids - let xs = uncurry toTeamStatus <$> cfgs - pure $ Multi.TeamFeatureNoConfigMultiResponse xs - toTeamStatus :: TeamId -> LockableFeature cfg -> Multi.TeamStatus cfg toTeamStatus tid feat = Multi.TeamStatus tid feat.status @@ -284,22 +269,6 @@ getFeatureForTeam tid = do defFeature dbFeature -getFeatureForMultiTeam :: - forall cfg r. - ( GetFeatureConfig cfg, - ComputeFeatureConstraints cfg r, - Member TeamFeatureStore r, - Member (Input Opts) r - ) => - [TeamId] -> - Sem r [(TeamId, LockableFeature cfg)] -getFeatureForMultiTeam tids = do - defFeature <- getFeatureForServer - features <- getDbFeatureMulti tids - for features $ \(tid, dbFeature) -> do - feat <- computeFeature @cfg tid defFeature dbFeature - pure (tid, feat) - getFeatureForTeamUser :: forall cfg r. ( GetFeatureConfig cfg, diff --git a/services/galley/src/Galley/Cassandra/TeamFeatures.hs b/services/galley/src/Galley/Cassandra/TeamFeatures.hs index 55bb2a9b840..04a5ab8f3ab 100644 --- a/services/galley/src/Galley/Cassandra/TeamFeatures.hs +++ b/services/galley/src/Galley/Cassandra/TeamFeatures.hs @@ -19,7 +19,6 @@ module Galley.Cassandra.TeamFeatures ( interpretTeamFeatureStoreToCassandra, - getDbFeatureMulti, getAllTeamFeaturesForServer, ) where @@ -38,7 +37,6 @@ import Imports import Polysemy import Polysemy.Input import Polysemy.TinyLog -import UnliftIO.Async (pooledMapConcurrentlyN) import Wire.API.Team.Feature interpretTeamFeatureStoreToCassandra :: @@ -52,9 +50,6 @@ interpretTeamFeatureStoreToCassandra = interpret $ \case TFS.GetDbFeature sing tid -> do logEffect "TeamFeatureStore.GetFeatureConfig" embedClient $ getDbFeature sing tid - TFS.GetDbFeatureMulti sing tids -> do - logEffect "TeamFeatureStore.GetFeatureConfigMulti" - embedClient $ getDbFeatureMulti sing tids TFS.SetDbFeature sing tid feat -> do logEffect "TeamFeatureStore.SetFeatureConfig" embedClient $ setDbFeature sing tid feat @@ -65,15 +60,6 @@ interpretTeamFeatureStoreToCassandra = interpret $ \case logEffect "TeamFeatureStore.GetAllTeamFeatures" embedClient $ getAllDbFeatures tid -getDbFeatureMulti :: - forall cfg m. - (MonadClient m, MonadUnliftIO m) => - FeatureSingleton cfg -> - [TeamId] -> - m [(TeamId, DbFeature cfg)] -getDbFeatureMulti proxy = - pooledMapConcurrentlyN 8 (\tid -> getDbFeature proxy tid <&> (tid,)) - getDbFeature :: (MonadClient m) => FeatureSingleton cfg -> TeamId -> m (DbFeature cfg) getDbFeature = $(featureCases [|fetchFeature|]) diff --git a/services/galley/src/Galley/Effects/TeamFeatureStore.hs b/services/galley/src/Galley/Effects/TeamFeatureStore.hs index a7773e1fe7f..b756ff9281f 100644 --- a/services/galley/src/Galley/Effects/TeamFeatureStore.hs +++ b/services/galley/src/Galley/Effects/TeamFeatureStore.hs @@ -27,10 +27,6 @@ data TeamFeatureStore m a where FeatureSingleton cfg -> TeamId -> TeamFeatureStore m (DbFeature cfg) - GetDbFeatureMulti :: - FeatureSingleton cfg -> - [TeamId] -> - TeamFeatureStore m [(TeamId, DbFeature cfg)] SetDbFeature :: FeatureSingleton cfg -> TeamId -> @@ -51,12 +47,6 @@ getDbFeature :: Sem r (DbFeature cfg) getDbFeature tid = send (GetDbFeature featureSingleton tid) -getDbFeatureMulti :: - (Member TeamFeatureStore r, IsFeatureConfig cfg) => - [TeamId] -> - Sem r [(TeamId, DbFeature cfg)] -getDbFeatureMulti tids = send (GetDbFeatureMulti featureSingleton tids) - setDbFeature :: (Member TeamFeatureStore r, IsFeatureConfig cfg) => TeamId ->