mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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
This commit is contained in:
committed by
Christopher Speller
parent
d13ba8c55c
commit
234958e007
@@ -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, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user