-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow displaying emails of users #719
Changes from 8 commits
028e259
3936785
abaf242
90c26b4
f2edbe2
f84734c
150aaee
bb61f58
d8ae071
6f8df0e
176d32d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,8 @@ optSettings: | |
setDefaultLocale: en | ||
setMaxTeamSize: 32 | ||
setMaxConvSize: 16 | ||
optMutableSettings: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a better name for this? It's not great that our testing strategy leaks into our config 😢 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more way to test this would be to create a brig |
||
setEmailVisibility: visible_to_self | ||
|
||
logLevel: Warn | ||
logNetStrings: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Brig.API.Settings | ||
( putSettings | ||
, getSettings | ||
) where | ||
|
||
import Imports | ||
|
||
import Brig.API.Handler (Handler, JSON) | ||
import Brig.App (mutableSettings) | ||
import Brig.Options (MutableSettings, MutableSettings') | ||
import Control.Lens | ||
import Data.Barbie (bzipWith) | ||
import Network.HTTP.Types.Status (status200) | ||
import Network.Wai (Response) | ||
import Network.Wai.Utilities (JsonRequest, empty, json, parseBody', setStatus) | ||
|
||
-- | Update the provided settings accordingly | ||
putSettings :: JsonRequest (MutableSettings' Maybe) -> Handler Response | ||
putSettings body = do | ||
newSettings <- parseBody' body | ||
mSettingsVar <- view mutableSettings | ||
atomically $ do | ||
mSettings <- readTVar mSettingsVar | ||
let mergedSettings :: MutableSettings | ||
mergedSettings = bzipWith fromMaybe' mSettings newSettings | ||
writeTVar mSettingsVar mergedSettings | ||
return $ (setStatus status200 empty) | ||
where | ||
fromMaybe' :: Identity a -> Maybe a -> Identity a | ||
fromMaybe' a ma = maybe a Identity ma | ||
|
||
|
||
-- | Update the provided settings accordingly | ||
getSettings :: JSON -> Handler Response | ||
getSettings _ = do | ||
mSet <- view mutableSettings >>= readTVarIO | ||
return . setStatus status200 | ||
$ json mSet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name isn't super clear about its behaviour. Anyone have suggestions?