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
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
d13ba8c55c
Коммит
234958e007
@@ -73,6 +73,21 @@ func createChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if channel.TeamId == c.TeamId {
|
||||
|
||||
// Get total number of channels on current team
|
||||
if result := <-Srv.Store.Channel().GetChannels(channel.TeamId, c.Session.UserId); result.Err != nil {
|
||||
c.Err = model.NewLocAppError("createChannel", "api.channel.get_channels.error", nil, result.Err.Message)
|
||||
return
|
||||
} else {
|
||||
data := result.Data.(*model.ChannelList)
|
||||
if int64(len(data.Channels)+1) > *utils.Cfg.TeamSettings.MaxChannelsPerTeam {
|
||||
c.Err = model.NewLocAppError("createChannel", "api.channel.create_channel.max_channel_limit.app_error", map[string]interface{}{"MaxChannelsPerTeam": *utils.Cfg.TeamSettings.MaxChannelsPerTeam}, "")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
channel.CreatorId = c.Session.UserId
|
||||
|
||||
if sc, err := CreateChannel(c, channel, true); err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user