Skip to content

Commit

Permalink
Add locale update to user subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
pcapriotti committed May 14, 2024
1 parent 924dd98 commit e0410f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/Routes/Public/Brig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ type SelfAPI =
"change-locale"
( Summary "Change your locale."
:> MakesFederatedCall 'Brig "send-connection-action"
:> ZUser
:> ZLocalUser
:> ZConn
:> "self"
:> "locale"
Expand Down
6 changes: 4 additions & 2 deletions libs/wire-subsystems/src/Wire/UserStore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ data UserProfileUpdate = MkUserProfileUpdate
{ name :: Maybe Name,
pict :: Maybe Pict,
assets :: Maybe [Asset],
accentId :: Maybe ColourId
accentId :: Maybe ColourId,
locale :: Maybe Locale
}
deriving stock (Eq, Ord, Show, Generic)
deriving (Arbitrary) via GenericUniform UserProfileUpdate
Expand All @@ -27,7 +28,8 @@ instance Default UserProfileUpdate where
{ name = Nothing,
pict = Nothing,
assets = Nothing,
accentId = Nothing
accentId = Nothing,
locale = Nothing
}

data UserStore m a where
Expand Down
18 changes: 9 additions & 9 deletions services/brig/src/Brig/API/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -984,18 +984,18 @@ changePassword :: UserId -> Public.PasswordChange -> (Handler r) (Maybe Public.C
changePassword u cp = lift . exceptTToMaybe $ API.changePassword u cp

changeLocale ::
( Member (Embed HttpClientIO) r,
Member NotificationSubsystem r,
Member TinyLog r,
Member (Input (Local ())) r,
Member (Input UTCTime) r,
Member (ConnectionStore InternalPaging) r
) =>
UserId ->
Member UserSubsystem r =>
Local UserId ->
ConnId ->
Public.LocaleUpdate ->
(Handler r) ()
changeLocale u conn l = lift $ API.changeLocale u conn l
changeLocale lusr conn l =
lift . liftSem $
updateUserProfile
lusr
(Just conn)
def {locale = Just l.luLocale}
ForbidSCIMUpdates

changeSupportedProtocols ::
( Member (Embed HttpClientIO) r,
Expand Down

0 comments on commit e0410f2

Please sign in to comment.