Skip to content
Closed
1 change: 1 addition & 0 deletions changelog.d/5-internal/galley-unlift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add type parameter for Galley effects and remove `MonadUnliftIO` instance.
7 changes: 3 additions & 4 deletions libs/bilge/src/Bilge/RPC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ import Bilge.IO
import Bilge.Request
import Bilge.Response
import Control.Error hiding (err)
import Control.Monad.Catch (MonadThrow (..))
import Control.Monad.Catch (MonadCatch, MonadThrow (..), try)
import Control.Monad.Except
import Data.Aeson (FromJSON, eitherDecode')
import Data.CaseInsensitive (original)
import Data.Text.Lazy (pack)
import Imports hiding (log)
import qualified Network.HTTP.Client as HTTP
import System.Logger.Class
import UnliftIO.Exception (try)

class HasRequestId m where
getRequestId :: m RequestId
Expand Down Expand Up @@ -69,7 +68,7 @@ instance Show RPCException where
. showString "}"

rpc ::
(MonadUnliftIO m, MonadHttp m, HasRequestId m, MonadLogger m, MonadThrow m) =>
(MonadIO m, MonadCatch m, MonadHttp m, HasRequestId m, MonadLogger m) =>
LText ->
(Request -> Request) ->
m (Response (Maybe LByteString))
Expand All @@ -81,7 +80,7 @@ rpc sys = rpc' sys empty
-- Note: 'syncIO' is wrapped around the IO action performing the request
-- and any exceptions caught are re-thrown in an 'RPCException'.
rpc' ::
(MonadUnliftIO m, MonadHttp m, HasRequestId m, MonadThrow m) =>
(MonadIO m, MonadCatch m, MonadHttp m, HasRequestId m) =>
-- | A label for the remote system in case of 'RPCException's.
LText ->
Request ->
Expand Down
11 changes: 9 additions & 2 deletions services/galley/galley.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 1daf2eec8d6d9666168a442a3c2856c2d453361e3bbffcc4a17c55d8bbf914f4
-- hash: 0086c8013de02473589b3121a003b7cc2d2b0e5ad89980fef0f7eb2ff02477eb

name: galley
version: 0.83.0
Expand Down Expand Up @@ -55,6 +55,7 @@ library
Galley.Data.TeamFeatures
Galley.Data.TeamNotifications
Galley.Data.Types
Galley.Effects
Galley.External
Galley.External.LegalHoldService
Galley.Intra.Client
Expand Down Expand Up @@ -121,6 +122,7 @@ library
, mtl >=2.2
, optparse-applicative >=0.10
, pem
, polysemy
, proto-lens >=0.2
, protobuf >=0.2
, raw-strings-qq >=1.0
Expand All @@ -146,7 +148,7 @@ library
, time >=1.4
, tinylog >=0.10
, tls >=1.3.10
, transformers >=0.3
, transformers
, types-common >=0.16
, types-common-journal >=0.1
, unliftio >=0.2
Expand Down Expand Up @@ -186,6 +188,7 @@ executable galley
, servant-client
, ssl-util
, tagged
, transformers
, types-common
, wire-api
, wire-api-federation
Expand Down Expand Up @@ -283,6 +286,7 @@ executable galley-integration
, time
, tinylog
, tls >=1.3.8
, transformers
, types-common
, types-common-journal
, unliftio
Expand Down Expand Up @@ -334,6 +338,7 @@ executable galley-migrate-data
, text
, time
, tinylog
, transformers
, types-common
, unliftio
, wire-api
Expand Down Expand Up @@ -400,6 +405,7 @@ executable galley-schema
, tagged
, text
, tinylog
, transformers
, wire-api
, wire-api-federation
if flag(static)
Expand Down Expand Up @@ -444,6 +450,7 @@ test-suite galley-types-tests
, tasty-hspec
, tasty-hunit
, tasty-quickcheck
, transformers
, types-common
, wai
, wai-predicates
Expand Down
3 changes: 2 additions & 1 deletion services/galley/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
- tagged
- servant-client
- saml2-web-sso >=0.18
- transformers

library:
source-dirs: src
Expand Down Expand Up @@ -64,6 +65,7 @@ library:
- mtl >=2.2
- optparse-applicative >=0.10
- pem
- polysemy
- protobuf >=0.2
- proto-lens >=0.2
- QuickCheck >=2.14
Expand All @@ -85,7 +87,6 @@ library:
- time >=1.4
- tinylog >=0.10
- tls >=1.3.10
- transformers >=0.3
- types-common >=0.16
- types-common-journal >=0.1
- unliftio >=0.2
Expand Down
4 changes: 2 additions & 2 deletions services/galley/src/Galley/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ where
import qualified Data.Swagger.Build.Api as Doc
import qualified Galley.API.Internal as Internal
import qualified Galley.API.Public as Public
import Galley.App (Galley)
import Galley.App (Galley0)
import Network.Wai.Routing (Routes)

sitemap :: Routes Doc.ApiBuilder Galley ()
sitemap :: Routes Doc.ApiBuilder Galley0 ()
sitemap = do
Public.sitemap
Public.apiDocs
Expand Down
8 changes: 4 additions & 4 deletions services/galley/src/Galley/API/Clients.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import Network.Wai
import Network.Wai.Predicate hiding (setStatus)
import Network.Wai.Utilities

getClientsH :: UserId -> Galley Response
getClientsH :: UserId -> Galley r Response
getClientsH usr = do
json <$> getClients usr

getClients :: UserId -> Galley [ClientId]
getClients :: UserId -> Galley r [ClientId]
getClients usr = do
isInternal <- view $ options . optSettings . setIntraListing
clts <-
Expand All @@ -47,12 +47,12 @@ getClients usr = do
else Data.lookupClients [usr]
return $ clientIds usr clts

addClientH :: UserId ::: ClientId -> Galley Response
addClientH :: UserId ::: ClientId -> Galley r Response
addClientH (usr ::: clt) = do
Data.updateClient True usr clt
return empty

rmClientH :: UserId ::: ClientId -> Galley Response
rmClientH :: UserId ::: ClientId -> Galley r Response
rmClientH (usr ::: clt) = do
Data.updateClient False usr clt
return empty
Loading