diff options
author | S4KH <kh.syerikjan@gmail.com> | 2016-10-21 20:36:13 +0800 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-10-21 08:36:13 -0400 |
commit | 234958e0076655efd8a58ea4502edce3226418ed (patch) | |
tree | 568c2e2f06a6921414e2cded9cb682651768aee8 /model | |
parent | d13ba8c55c981978f3b962c6991f478b36bf8a8b (diff) | |
download | chat-234958e0076655efd8a58ea4502edce3226418ed.tar.gz chat-234958e0076655efd8a58ea4502edce3226418ed.tar.bz2 chat-234958e0076655efd8a58ea4502edce3226418ed.zip |
HW 4139: Make channel limits configurable in the System Console (#4154)
* Auto Changes
* 4139 Made channel limits configurable in the System Console as described in the issue
* Removed error message entries from other locales, made maxChannelsPerteam type to pointer
* Added * symbol to maxChannelsPerTeam inside isValid function
* Update team_test.go
* Restored to old test
* Checked maximum number channels per team when creating channel
* Fixed code to pass api/channel_test.go
* Reverted changes on config except MaxChannelsPerTeam
* Update channel.go
* Ran gofmt -w .
* Reverted vendor directoy
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go index 8d49434f6..09bf11a71 100644 --- a/model/config.go +++ b/model/config.go @@ -223,6 +223,7 @@ type TeamSettings struct { RestrictPublicChannelManagement *string RestrictPrivateChannelManagement *string UserStatusAwayTimeout *int64 + MaxChannelsPerTeam *int64 } type LdapSettings struct { @@ -502,6 +503,11 @@ func (o *Config) SetDefaults() { *o.TeamSettings.UserStatusAwayTimeout = 300 } + if o.TeamSettings.MaxChannelsPerTeam == nil { + o.TeamSettings.MaxChannelsPerTeam = new(int64) + *o.TeamSettings.MaxChannelsPerTeam = 2000 + } + if o.EmailSettings.EnableSignInWithEmail == nil { o.EmailSettings.EnableSignInWithEmail = new(bool) @@ -984,6 +990,10 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "") } + if *o.TeamSettings.MaxChannelsPerTeam <= 0 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.max_channels.app_error", nil, "") + } + if !(*o.TeamSettings.RestrictDirectMessage == DIRECT_MESSAGE_ANY || *o.TeamSettings.RestrictDirectMessage == DIRECT_MESSAGE_TEAM) { return NewLocAppError("Config.IsValid", "model.config.is_valid.restrict_direct_message.app_error", nil, "") } |