diff --git a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs index ba2c5e02e54..030d84247cd 100644 --- a/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs +++ b/libs/wire-api-federation/test/Test/Wire/API/Federation/Golden/Runner.hs @@ -17,8 +17,6 @@ module Test.Wire.API.Federation.Golden.Runner ( testObjects, - testFromJSONFailure, - testFromJSONObjects, ) where @@ -60,25 +58,6 @@ testObject obj path = do pure exists -testFromJSONObjects :: forall a. (Typeable a, FromJSON a, Eq a, Show a) => [(a, FilePath)] -> IO () -testFromJSONObjects = traverse_ (uncurry testFromJSONObject) - -testFromJSONObject :: forall a. (Typeable a, FromJSON a, Eq a, Show a) => a -> FilePath -> IO () -testFromJSONObject expected path = do - let dir = "test/golden/fromJSON" - fullPath = dir <> "/" <> path - parsed <- eitherDecodeFileStrict fullPath - assertEqual (show (typeRep @a) <> ": FromJSON of " <> path <> " should match object") (Right expected) parsed - -testFromJSONFailure :: forall a. (Typeable a, FromJSON a, Show a) => FilePath -> IO () -testFromJSONFailure path = do - let dir = "test/golden/fromJSON" - fullPath = dir <> "/" <> path - parsed <- eitherDecodeFileStrict @a fullPath - case parsed of - Right x -> assertFailure $ show (typeRep @a) <> ": FromJSON of " <> path <> ": expected failure, got " <> show x - Left _ -> pure () - assertRight :: (Show a) => Either a b -> IO b assertRight = \case diff --git a/libs/wire-api/src/Wire/API/Routes/Internal/LegalHold.hs b/libs/wire-api/src/Wire/API/Routes/Internal/LegalHold.hs index ffde2e561c3..f77137eab0a 100644 --- a/libs/wire-api/src/Wire/API/Routes/Internal/LegalHold.hs +++ b/libs/wire-api/src/Wire/API/Routes/Internal/LegalHold.hs @@ -39,6 +39,7 @@ type InternalLegalHoldAPI = :> Put '[] NoContent ) +-- TODO: should be called, is currently dead code. swaggerDoc :: OpenApi swaggerDoc = toOpenApi (Proxy @InternalLegalHoldAPI) diff --git a/libs/wire-api/src/Wire/API/UserEvent.hs b/libs/wire-api/src/Wire/API/UserEvent.hs index acc39c3ebc2..23f6de751e9 100644 --- a/libs/wire-api/src/Wire/API/UserEvent.hs +++ b/libs/wire-api/src/Wire/API/UserEvent.hs @@ -188,18 +188,10 @@ emailRemoved :: UserId -> Email -> UserEvent emailRemoved u e = UserIdentityRemoved $ UserIdentityRemovedData u (Just e) Nothing -phoneRemoved :: UserId -> Phone -> UserEvent -phoneRemoved u p = - UserIdentityRemoved $ UserIdentityRemovedData u Nothing (Just p) - emailUpdated :: UserId -> Email -> UserEvent emailUpdated u e = UserIdentityUpdated $ UserIdentityUpdatedData u (Just e) Nothing -phoneUpdated :: UserId -> Phone -> UserEvent -phoneUpdated u p = - UserIdentityUpdated $ UserIdentityUpdatedData u Nothing (Just p) - emptyUserUpdatedData :: UserId -> UserUpdatedData emptyUserUpdatedData u = UserUpdatedData diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs index fe01eb3ec34..d2c152497d3 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs @@ -86,7 +86,6 @@ import Test.Wire.API.Golden.Generated.Event_conversation qualified import Test.Wire.API.Golden.Generated.Event_featureConfig qualified import Test.Wire.API.Golden.Generated.Event_team qualified import Test.Wire.API.Golden.Generated.Event_user qualified -import Test.Wire.API.Golden.Generated.FeatureStatus_team qualified import Test.Wire.API.Golden.Generated.HandleUpdate_user qualified import Test.Wire.API.Golden.Generated.InvitationCode_user qualified import Test.Wire.API.Golden.Generated.InvitationList_team qualified @@ -1429,30 +1428,6 @@ tests = (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_9, "testObject_Event_featureConfig_9.json"), (Test.Wire.API.Golden.Generated.Event_featureConfig.testObject_Event_featureConfig_10, "testObject_Event_featureConfig_10.json") ], - testGroup - "Golden: FeatureStatus_team" - $ testObjects - [ (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_1, "testObject_FeatureStatus_team_1.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_2, "testObject_FeatureStatus_team_2.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_3, "testObject_FeatureStatus_team_3.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_4, "testObject_FeatureStatus_team_4.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_5, "testObject_FeatureStatus_team_5.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_6, "testObject_FeatureStatus_team_6.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_7, "testObject_FeatureStatus_team_7.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_8, "testObject_FeatureStatus_team_8.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_9, "testObject_FeatureStatus_team_9.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_10, "testObject_FeatureStatus_team_10.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_11, "testObject_FeatureStatus_team_11.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_12, "testObject_FeatureStatus_team_12.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_13, "testObject_FeatureStatus_team_13.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_14, "testObject_FeatureStatus_team_14.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_15, "testObject_FeatureStatus_team_15.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_16, "testObject_FeatureStatus_team_16.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_17, "testObject_FeatureStatus_team_17.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_18, "testObject_FeatureStatus_team_18.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_19, "testObject_FeatureStatus_team_19.json"), - (Test.Wire.API.Golden.Generated.FeatureStatus_team.testObject_FeatureStatus_team_20, "testObject_FeatureStatus_team_20.json") - ], testGroup "Golden: Event_Conversation" $ testObjects diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/FeatureStatus_team.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/FeatureStatus_team.hs deleted file mode 100644 index 6c1d40ec4ed..00000000000 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/FeatureStatus_team.hs +++ /dev/null @@ -1,80 +0,0 @@ --- This file is part of the Wire Server implementation. --- --- Copyright (C) 2022 Wire Swiss GmbH --- --- This program is free software: you can redistribute it and/or modify it under --- the terms of the GNU Affero General Public License as published by the Free --- Software Foundation, either version 3 of the License, or (at your option) any --- later version. --- --- This program is distributed in the hope that it will be useful, but WITHOUT --- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS --- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more --- details. --- --- You should have received a copy of the GNU Affero General Public License along --- with this program. If not, see . - -module Test.Wire.API.Golden.Generated.FeatureStatus_team where - -import Wire.API.Team.Feature (FeatureStatus (..)) - -testObject_FeatureStatus_team_1 :: FeatureStatus -testObject_FeatureStatus_team_1 = FeatureStatusEnabled - -testObject_FeatureStatus_team_2 :: FeatureStatus -testObject_FeatureStatus_team_2 = FeatureStatusDisabled - -testObject_FeatureStatus_team_3 :: FeatureStatus -testObject_FeatureStatus_team_3 = FeatureStatusEnabled - -testObject_FeatureStatus_team_4 :: FeatureStatus -testObject_FeatureStatus_team_4 = FeatureStatusDisabled - -testObject_FeatureStatus_team_5 :: FeatureStatus -testObject_FeatureStatus_team_5 = FeatureStatusEnabled - -testObject_FeatureStatus_team_6 :: FeatureStatus -testObject_FeatureStatus_team_6 = FeatureStatusDisabled - -testObject_FeatureStatus_team_7 :: FeatureStatus -testObject_FeatureStatus_team_7 = FeatureStatusEnabled - -testObject_FeatureStatus_team_8 :: FeatureStatus -testObject_FeatureStatus_team_8 = FeatureStatusEnabled - -testObject_FeatureStatus_team_9 :: FeatureStatus -testObject_FeatureStatus_team_9 = FeatureStatusDisabled - -testObject_FeatureStatus_team_10 :: FeatureStatus -testObject_FeatureStatus_team_10 = FeatureStatusDisabled - -testObject_FeatureStatus_team_11 :: FeatureStatus -testObject_FeatureStatus_team_11 = FeatureStatusEnabled - -testObject_FeatureStatus_team_12 :: FeatureStatus -testObject_FeatureStatus_team_12 = FeatureStatusEnabled - -testObject_FeatureStatus_team_13 :: FeatureStatus -testObject_FeatureStatus_team_13 = FeatureStatusEnabled - -testObject_FeatureStatus_team_14 :: FeatureStatus -testObject_FeatureStatus_team_14 = FeatureStatusDisabled - -testObject_FeatureStatus_team_15 :: FeatureStatus -testObject_FeatureStatus_team_15 = FeatureStatusDisabled - -testObject_FeatureStatus_team_16 :: FeatureStatus -testObject_FeatureStatus_team_16 = FeatureStatusDisabled - -testObject_FeatureStatus_team_17 :: FeatureStatus -testObject_FeatureStatus_team_17 = FeatureStatusDisabled - -testObject_FeatureStatus_team_18 :: FeatureStatus -testObject_FeatureStatus_team_18 = FeatureStatusDisabled - -testObject_FeatureStatus_team_19 :: FeatureStatus -testObject_FeatureStatus_team_19 = FeatureStatusEnabled - -testObject_FeatureStatus_team_20 :: FeatureStatus -testObject_FeatureStatus_team_20 = FeatureStatusDisabled diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/NewConv_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/NewConv_user.hs index 654575f9943..65d223dcd11 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/NewConv_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/NewConv_user.hs @@ -19,7 +19,6 @@ module Test.Wire.API.Golden.Generated.NewConv_user where -import Data.Domain (Domain (Domain)) import Data.Id import Data.Misc (Milliseconds (Ms, ms)) import Data.Set qualified as Set (fromList) @@ -29,9 +28,6 @@ import Wire.API.Conversation import Wire.API.Conversation.Role import Wire.API.User -testDomain :: Domain -testDomain = Domain "testdomain.example.com" - testObject_NewConv_user_1 :: NewConv testObject_NewConv_user_1 = NewConv diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs index f2e7e5adf51..feae9694e32 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs @@ -68,7 +68,8 @@ tests = (testObject_UserClientPrekeyMap_5, "testObject_UserClientPrekeyMap_5.json"), (testObject_UserClientPrekeyMap_6, "testObject_UserClientPrekeyMap_6.json"), (testObject_UserClientPrekeyMap_7, "testObject_UserClientPrekeyMap_7.json"), - (testObject_UserClientPrekeyMap_8, "testObject_UserClientPrekeyMap_8.json") + (testObject_UserClientPrekeyMap_8, "testObject_UserClientPrekeyMap_8.json"), + (testObject_UserClientPrekeyMap_8, "testObject_UserClientPrekeyMap_9.json") ], testGroup "QualifiedUserClientPrekeyMap" $ testObjects diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs index 81b85c39424..37f444be782 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Protobuf.hs @@ -57,6 +57,9 @@ tests = ( testObject_QualifiedNewOtrMessage_user_9, "testObject_QualifiedNewOtrMessage_user_9.protobuf" ), + ( testObject_QualifiedNewOtrMessage_user_10, + "testObject_QualifiedNewOtrMessage_user_10.protobuf" + ), ( testObject_QualifiedNewOtrMessage_user_11, "testObject_QualifiedNewOtrMessage_user_11.protobuf" ), diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_1.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_1.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_1.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_10.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_10.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_10.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_11.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_11.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_11.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_12.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_12.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_12.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_13.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_13.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_13.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_14.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_14.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_14.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_15.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_15.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_15.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_16.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_16.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_16.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_17.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_17.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_17.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_18.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_18.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_18.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_19.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_19.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_19.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_2.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_2.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_2.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_20.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_20.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_20.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_3.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_3.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_3.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_4.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_4.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_4.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_5.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_5.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_5.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_6.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_6.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_6.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_7.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_7.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_7.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_8.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_8.json deleted file mode 100644 index 78bf971c5a4..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_8.json +++ /dev/null @@ -1 +0,0 @@ -"enabled" diff --git a/libs/wire-api/test/golden/testObject_FeatureStatus_team_9.json b/libs/wire-api/test/golden/testObject_FeatureStatus_team_9.json deleted file mode 100644 index a0760977f71..00000000000 --- a/libs/wire-api/test/golden/testObject_FeatureStatus_team_9.json +++ /dev/null @@ -1 +0,0 @@ -"disabled" diff --git a/libs/wire-api/test/golden/testObject_QualifiedNewOtrMessage_user_10.protobuf b/libs/wire-api/test/golden/testObject_QualifiedNewOtrMessage_user_10.protobuf new file mode 100644 index 00000000000..2d80c883253 --- /dev/null +++ b/libs/wire-api/test/golden/testObject_QualifiedNewOtrMessage_user_10.protobuf @@ -0,0 +1,11 @@ +sender { client: 8 } +recipients { domain: "79-y-r4-9.d" } +recipients { domain: "7f3.ra.9.r37.xavdz88-9vw-z" } +recipients { domain: "7g.hw9aq-1" } +recipients { domain: "8w5.g5l-7.tys" } +recipients { domain: "n.659-s.nfd" } +recipients { domain: "pc5s-p9-48-x.r8cq.ss89h" } +native_push: false +blob: "GL\006" +transient: false +ignore_all { } \ No newline at end of file diff --git a/libs/wire-api/test/golden/testObject_UserClientPrekeyMap_9.json b/libs/wire-api/test/golden/testObject_UserClientPrekeyMap_9.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/libs/wire-api/test/golden/testObject_UserClientPrekeyMap_9.json @@ -0,0 +1 @@ +{} diff --git a/libs/wire-api/wire-api.cabal b/libs/wire-api/wire-api.cabal index 191643405d7..5f1a6b8bdc0 100644 --- a/libs/wire-api/wire-api.cabal +++ b/libs/wire-api/wire-api.cabal @@ -420,7 +420,6 @@ test-suite wire-api-golden-tests Test.Wire.API.Golden.Generated.Event_user Test.Wire.API.Golden.Generated.EventType_team Test.Wire.API.Golden.Generated.EventType_user - Test.Wire.API.Golden.Generated.FeatureStatus_team Test.Wire.API.Golden.Generated.HandleUpdate_user Test.Wire.API.Golden.Generated.Invitation_team Test.Wire.API.Golden.Generated.InvitationCode_user diff --git a/services/brig/src/Brig/App.hs b/services/brig/src/Brig/App.hs index 4c9e0e75b74..d5b051a3508 100644 --- a/services/brig/src/Brig/App.hs +++ b/services/brig/src/Brig/App.hs @@ -83,7 +83,6 @@ module Brig.App runHttpClientIO, liftSem, lowerAppT, - temporaryGetEnv, initHttpManagerWithTLSConfig, adhocUserKeyStoreInterpreter, adhocSessionStoreInterpreter, @@ -464,9 +463,6 @@ newtype AppT r a = AppT lowerAppT :: (Member (Final IO) r) => Env -> AppT r a -> Sem r a lowerAppT env (AppT r) = runReaderT r env -temporaryGetEnv :: AppT r Env -temporaryGetEnv = AppT ask - instance Functor (AppT r) where fmap fab (AppT x0) = AppT $ fmap fab x0 diff --git a/services/brig/src/Brig/Data/User.hs b/services/brig/src/Brig/Data/User.hs index bd4da155d8b..147fd666c7a 100644 --- a/services/brig/src/Brig/Data/User.hs +++ b/services/brig/src/Brig/Data/User.hs @@ -28,7 +28,6 @@ module Brig.Data.User insertAccount, authenticate, reauthenticate, - filterActive, isSamlUser, -- * Lookups @@ -342,15 +341,6 @@ updateStatus u s = userExists :: (MonadClient m) => UserId -> m Bool userExists uid = isJust <$> retry x1 (query1 idSelect (params LocalQuorum (Identity uid))) -filterActive :: (MonadClient m) => [UserId] -> m [UserId] -filterActive us = - map (view _1) . filter isActiveUser - <$> retry x1 (query accountStateSelectAll (params LocalQuorum (Identity us))) - where - isActiveUser :: (UserId, Bool, Maybe AccountStatus) -> Bool - isActiveUser (_, True, Just Active) = True - isActiveUser _ = False - lookupUser :: (MonadClient m, MonadReader Env m) => HavePendingInvitations -> UserId -> m (Maybe User) lookupUser hpi u = listToMaybe <$> lookupUsers hpi [u] @@ -528,9 +518,6 @@ nameSelect = "SELECT name FROM user WHERE id = ?" authSelect :: PrepQuery R (Identity UserId) (Maybe Password, Maybe AccountStatus) authSelect = "SELECT password, status FROM user WHERE id = ?" -accountStateSelectAll :: PrepQuery R (Identity [UserId]) (UserId, Bool, Maybe AccountStatus) -accountStateSelectAll = "SELECT id, activated, status FROM user WHERE id IN ?" - richInfoSelect :: PrepQuery R (Identity UserId) (Identity RichInfoAssocList) richInfoSelect = "SELECT json FROM rich_info WHERE user = ?" diff --git a/services/brig/src/Brig/Options.hs b/services/brig/src/Brig/Options.hs index 96a1c81341b..9be924b3866 100644 --- a/services/brig/src/Brig/Options.hs +++ b/services/brig/src/Brig/Options.hs @@ -743,9 +743,6 @@ instance ToJSON AccountFeatureConfigs where getAfcConferenceCallingDefNewMaybe :: Lens.Getter Settings (Maybe (Public.WithStatus Public.ConferenceCallingConfig)) getAfcConferenceCallingDefNewMaybe = Lens.to (Lens.^? (Lens.to setFeatureFlags . Lens._Just . Lens.to afcConferenceCallingDefNew . unImplicitLockStatus)) -getAfcConferenceCallingDefNew :: Lens.Getter Settings (Public.WithStatus Public.ConferenceCallingConfig) -getAfcConferenceCallingDefNew = Lens.to (Public._unImplicitLockStatus . afcConferenceCallingDefNew . fromMaybe defAccountFeatureConfigs . setFeatureFlags) - getAfcConferenceCallingDefNull :: Lens.Getter Settings (Public.WithStatus Public.ConferenceCallingConfig) getAfcConferenceCallingDefNull = Lens.to (Public._unImplicitLockStatus . afcConferenceCallingDefNull . fromMaybe defAccountFeatureConfigs . setFeatureFlags) diff --git a/services/gundeck/src/Gundeck/Monad.hs b/services/gundeck/src/Gundeck/Monad.hs index 5320f725501..1ccce16a55b 100644 --- a/services/gundeck/src/Gundeck/Monad.hs +++ b/services/gundeck/src/Gundeck/Monad.hs @@ -32,7 +32,6 @@ module Gundeck.Monad runDirect, runGundeck, fromJsonBody, - ifNothing, posixTime, -- * Select which redis to target @@ -206,10 +205,6 @@ fromJsonBody :: (FromJSON a) => JsonRequest a -> Gundeck a fromJsonBody r = exceptT (throwM . mkError status400 "bad-request") pure (parseBody r) {-# INLINE fromJsonBody #-} -ifNothing :: Error -> Maybe a -> Gundeck a -ifNothing e = maybe (throwM e) pure -{-# INLINE ifNothing #-} - posixTime :: Gundeck Milliseconds posixTime = view time >>= liftIO {-# INLINE posixTime #-} diff --git a/services/spar/test-integration/Util/Types.hs b/services/spar/test-integration/Util/Types.hs index 777470f2bb2..553ed09674e 100644 --- a/services/spar/test-integration/Util/Types.hs +++ b/services/spar/test-integration/Util/Types.hs @@ -43,7 +43,6 @@ where import Bilge import Cassandra as Cas -import Control.Exception import Control.Lens (makeLenses, view) import Crypto.Random.Types (MonadRandom (..)) import Data.Aeson @@ -111,13 +110,13 @@ instance FromJSON TestErrorLabel where -- A quick unit test that serves two purposes: (1) shows that it works (and helped with debugging); -- (2) demonstrates how to use it. -_unitTestTestErrorLabel :: IO () -_unitTestTestErrorLabel = do - let val :: Either String TestErrorLabel - val = Aeson.eitherDecode "{\"code\":404,\"message\":\"Not found.\",\"label\":\"not-found\"}" - unless (val == Right "not-found") $ - throwIO . ErrorCall . show $ - val +-- _unitTestTestErrorLabel :: IO () +-- _unitTestTestErrorLabel = do +-- let val :: Either String TestErrorLabel +-- val = Aeson.eitherDecode "{\"code\":404,\"message\":\"Not found.\",\"label\":\"not-found\"}" +-- unless (val == Right "not-found") $ +-- throwIO . ErrorCall . show $ +-- val -- | FUTUREWORK(fisx): we're running all tests for all constructors of `WireIdPAPIVersion`, -- which sometimes makes little sense. 'skipIdPAPIVersions' can be used to pend individual diff --git a/tools/stern/src/Stern/API/Routes.hs b/tools/stern/src/Stern/API/Routes.hs index b52d262f142..fab41b2971a 100644 --- a/tools/stern/src/Stern/API/Routes.hs +++ b/tools/stern/src/Stern/API/Routes.hs @@ -21,13 +21,11 @@ module Stern.API.Routes SwaggerDocsAPI, swaggerDocs, UserConnectionGroups (..), - doubleMaybeToEither, RedirectToSwaggerDocsAPI, ) where import Control.Lens -import Control.Monad.Trans.Except import Data.Aeson qualified as A import Data.Handle import Data.Id @@ -35,8 +33,6 @@ import Data.Kind import Data.OpenApi qualified as S import Data.Schema qualified as Schema import Imports hiding (head) -import Network.HTTP.Types.Status -import Network.Wai.Utilities import Servant hiding (Handler, WithStatus (..), addHeader, respond) import Servant.OpenApi (HasOpenApi (toOpenApi)) import Servant.OpenApi.Internal.Orphans () @@ -482,11 +478,6 @@ instance Schema.ToSchema UserConnectionGroups where <*> ucgMissingLegalholdConsent Schema..= Schema.field "ucgMissingLegalholdConsent" Schema.schema <*> ucgTotal Schema..= Schema.field "ucgTotal" Schema.schema -doubleMaybeToEither :: (Monad m) => LText -> Maybe a -> Maybe b -> ExceptT Error m (Either a b) -doubleMaybeToEither _ (Just a) Nothing = pure $ Left a -doubleMaybeToEither _ Nothing (Just b) = pure $ Right b -doubleMaybeToEither msg _ _ = throwE $ mkError status400 "either-params" ("Must use exactly one of two query params: " <> msg) - type MkFeatureGetRoute (feature :: Type) = Summary "Shows whether a feature flag is enabled or not for a given team." :> "teams" diff --git a/tools/stern/src/Stern/Intra.hs b/tools/stern/src/Stern/Intra.hs index 326f5ebf821..8baf5875930 100644 --- a/tools/stern/src/Stern/Intra.hs +++ b/tools/stern/src/Stern/Intra.hs @@ -34,7 +34,6 @@ module Stern.Intra getInvoiceUrl, revokeIdentity, changeEmail, - changePhone, deleteAccount, setStatusBindingTeam, deleteBindingTeam, @@ -388,24 +387,6 @@ changeEmail u upd = do . expect2xx ) -changePhone :: UserId -> PhoneUpdate -> Handler () -changePhone u upd = do - info $ msg "Updating phone number" - b <- view brig - void - . catchRpcErrors - $ rpc' - "brig" - b - ( method PUT - . versionedPath "self/phone" - . header "Z-User" (toByteString' u) - . header "Z-Connection" (toByteString' "") - . lbytes (encode upd) - . contentJson - . expect2xx - ) - getTeamInfo :: TeamId -> Handler TeamInfo getTeamInfo tid = do d <- getTeamData tid diff --git a/weeder.toml b/weeder.toml index 3b2d1056098..9521cfeee9c 100644 --- a/weeder.toml +++ b/weeder.toml @@ -10,9 +10,12 @@ roots = [ # may of the entries here are about general-purpose module "^API.Galley.consentToLegalHold", # FUTUREWORK: write tests that need this! "^API.Galley.enableLegalHold", # FUTUREWORK: write tests that need this! "^API.Galley.getLegalHoldStatus", # FUTUREWORK: write tests that need this! + "^API.MLS.Util.getCurrentGroupId", "^API.MLS.Util.getKeyPackageCount", "^API.MLS.Util.getKeyPair", - "^API.MLS.Util.getCurrentGroupId", + "^API.Nginz.*$", # FUTUREWORK: consider using everything or cleaning up. + "^Bilge.*$", + "^Cassandra.Helpers.toOptionFieldName", "^Data.ETag._OpaqueDigest", "^Data.ETag._StrictETag", "^Data.ETag._WeakETag", @@ -22,18 +25,88 @@ roots = [ # may of the entries here are about general-purpose module "^Data.ETag.strictETag", "^Data.ETag.weakETag", "^Data.Qualified.isLocal", + "^Data.Range.*$", "^Data.Range.rappend", "^Data.Range.rcons", "^Data.Range.rinc", "^Data.Range.rsingleton", + "^Data.ZAuth.Validation.*$", + "^Galley.Types.UserList.ulDiff", + "^HTTP2.Client.Manager.*$", "^Imports.getChar", "^Imports.getContents", "^Imports.interact", "^Imports.putChar", "^Imports.readIO", "^Imports.readLn", + "^Main.debugMainDebugExportFull", # move-team + "^Main.debugMainExport", # move-team + "^Main.debugMainImport", # move-team "^Main.main$", + "^Network.Wai.Utilities.ZAuth.*$", + "^Notifications.*$", # new integration tests + "^ParseSchema._printAllTables", + "^ParseSchema.debug", + "^ParseSchema.debugwrite", + "^ParseSchema.projectFile", "^Paths_.*", + "^Proto.Mls_Fields.commit", + "^Proto.Mls_Fields.groupInfo", + "^Proto.Mls_Fields.groupInfoBundle", + "^Proto.Mls_Fields.groupInfoType", + "^Proto.Mls_Fields.ignoreAll", + "^Proto.Mls_Fields.ignoreOnly", + "^Proto.Mls_Fields.isInline", + "^Proto.Mls_Fields.maybe'blob", + "^Proto.Mls_Fields.maybe'ignoreAll", + "^Proto.Mls_Fields.maybe'ignoreOnly", + "^Proto.Mls_Fields.maybe'isInline", + "^Proto.Mls_Fields.maybe'nativePush", + "^Proto.Mls_Fields.maybe'reportAll", + "^Proto.Mls_Fields.maybe'reportOnly", + "^Proto.Mls_Fields.maybe'transient", + "^Proto.Mls_Fields.maybe'welcome", + "^Proto.Mls_Fields.nativePriority", + "^Proto.Mls_Fields.ratchetTreeType", + "^Proto.Mls_Fields.reportAll", + "^Proto.Mls_Fields.reportMissing", + "^Proto.Mls_Fields.reportOnly", + "^Proto.Mls_Fields.vec'clients", + "^Proto.Mls_Fields.vec'entries", + "^Proto.Mls_Fields.vec'recipients", + "^Proto.Mls_Fields.vec'reportMissing", + "^Proto.Mls_Fields.vec'userIds", + "^Proto.Mls_Fields.welcome", + "^Proto.Otr._QualifiedNewOtrMessage'IgnoreAll", + "^Proto.Otr._QualifiedNewOtrMessage'IgnoreOnly", + "^Proto.Otr._QualifiedNewOtrMessage'ReportAll", + "^Proto.Otr._QualifiedNewOtrMessage'ReportOnly", + "^Proto.Otr_Fields.ignoreAll", + "^Proto.Otr_Fields.ignoreOnly", + "^Proto.Otr_Fields.isInline", + "^Proto.Otr_Fields.maybe'blob", + "^Proto.Otr_Fields.maybe'ignoreAll", + "^Proto.Otr_Fields.maybe'ignoreOnly", + "^Proto.Otr_Fields.maybe'isInline", + "^Proto.Otr_Fields.maybe'nativePush", + "^Proto.Otr_Fields.maybe'reportAll", + "^Proto.Otr_Fields.maybe'reportOnly", + "^Proto.Otr_Fields.maybe'transient", + "^Proto.Otr_Fields.nativePriority", + "^Proto.Otr_Fields.reportAll", + "^Proto.Otr_Fields.reportMissing", + "^Proto.Otr_Fields.reportOnly", + "^Proto.Otr_Fields.vec'clients", + "^Proto.Otr_Fields.vec'entries", + "^Proto.Otr_Fields.vec'recipients", + "^Proto.Otr_Fields.vec'reportMissing", + "^Proto.Otr_Fields.vec'userIds", + "^Proto.TeamEvents_Fields.currency", + "^Proto.TeamEvents_Fields.vec'billingUser", + "^Spar.Sem.AReqIDStore.Mem.*$", # FUTUREWORK: @fisx can we delete this? + "^Spar.Sem.AssIDStore.Mem.*$", # FUTUREWORK: @fisx can we delete this? + "^Spar.Sem.ScimTokenStore.Mem.*$", # FUTUREWORK: @fisx can we delete this? + "^Spar.Sem.VerdictFormatStore.Mem.*$", # FUTUREWORK: @fisx can we delete this? "^Spec.main$", "^Test.Cargohold.API.Util.shouldMatchALittle", "^Test.Cargohold.API.Util.shouldMatchLeniently", @@ -41,6 +114,7 @@ roots = [ # may of the entries here are about general-purpose module "^Test.Data.Schema.detailSchema", "^Test.Data.Schema.userSchemaWithDefaultName", "^Test.Data.Schema.userSchemaWithDefaultName'", + "^Test.Wire.API.Golden.Run.main$", "^TestSetup.runFederationClient", "^TestSetup.viewCargohold", "^Testlib.Cannon.awaitAtLeastNMatches", @@ -51,18 +125,9 @@ roots = [ # may of the entries here are about general-purpose module "^Testlib.Cannon.printAwaitAtLeastResult", "^Testlib.Cannon.printAwaitResult", "^Testlib.JSON.member", - "^Testlib.Prelude.appendFile", - "^Testlib.Prelude.getChar", - "^Testlib.Prelude.getContents", - "^Testlib.Prelude.getLine", - "^Testlib.Prelude.interact", - "^Testlib.Prelude.print", - "^Testlib.Prelude.putChar", - "^Testlib.Prelude.putStr", - "^Testlib.Prelude.readFile", - "^Testlib.Prelude.readIO", - "^Testlib.Prelude.readLn", - "^Testlib.Prelude.writeFile", + "^Testlib.JSON.printJSON", + "^Testlib.JSON.traceJSON", + "^Testlib.Prelude.*$", # FUTUREWORK: consider making them individually "^Testlib.Printing.gray", "^Testlib.Printing.hline", "^Testlib.Run.main$", @@ -71,6 +136,7 @@ roots = [ # may of the entries here are about general-purpose module "^Util.assertOne", "^Util.randomActivationCode", "^Util.zClient", + "^Web.Scim.*$", "^Web.Scim.Client.deleteGroup", "^Web.Scim.Client.deleteUser", "^Web.Scim.Client.getGroup", @@ -92,7 +158,9 @@ roots = [ # may of the entries here are about general-purpose module "^Web.Scim.Test.Util.put'", "^Web.Scim.Test.Util.scim", "^Web.Scim.Test.Util.shouldEventuallyRespondWith", - "^Test.Wire.API.Golden.Run.main$" + "^Wire.API.MLS.Serialisation.traceMLS", # Debug + "^Wire.Sem.Concurrency.IO.performConcurrency", + "^Wire.Sem.Logger.fatal" ] type-class-roots = true # `root-instances` is more precise, but requires more config maintenance.