PLT-4665 Fix Max Channels limit wrong count (#4512)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
8c76560b48
Коммит
be17e05d73
@@ -77,7 +77,7 @@ func createChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
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 {
|
||||
if result := <-Srv.Store.Channel().GetTeamChannels(channel.TeamId); result.Err != nil {
|
||||
c.Err = model.NewLocAppError("createChannel", "api.channel.get_channels.error", nil, result.Err.Message)
|
||||
return
|
||||
} else {
|
||||
|
||||
@@ -464,6 +464,32 @@ func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) StoreCha
|
||||
return storeChannel
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetTeamChannels(teamId string) StoreChannel {
|
||||
storeChannel := make(StoreChannel, 1)
|
||||
|
||||
go func() {
|
||||
result := StoreResult{}
|
||||
|
||||
data := &model.ChannelList{}
|
||||
_, err := s.GetReplica().Select(data, "SELECT * FROM Channels WHERE TeamId = :TeamId And Type != 'D' ORDER BY DisplayName", map[string]interface{}{"TeamId": teamId})
|
||||
|
||||
if err != nil {
|
||||
result.Err = model.NewLocAppError("SqlChannelStore.GetChannels", "store.sql_channel.get_channels.get.app_error", nil, "teamId="+teamId+", err="+err.Error())
|
||||
} else {
|
||||
if len(*data) == 0 {
|
||||
result.Err = model.NewLocAppError("SqlChannelStore.GetChannels", "store.sql_channel.get_channels.not_found.app_error", nil, "teamId="+teamId)
|
||||
} else {
|
||||
result.Data = data
|
||||
}
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
close(storeChannel)
|
||||
}()
|
||||
|
||||
return storeChannel
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel {
|
||||
storeChannel := make(StoreChannel, 1)
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ type ChannelStore interface {
|
||||
GetChannels(teamId string, userId string) StoreChannel
|
||||
GetMoreChannels(teamId string, userId string) StoreChannel
|
||||
GetChannelCounts(teamId string, userId string) StoreChannel
|
||||
GetTeamChannels(teamId string) StoreChannel
|
||||
GetAll(teamId string) StoreChannel
|
||||
GetForPost(postId string) StoreChannel
|
||||
SaveMember(member *model.ChannelMember) StoreChannel
|
||||
|
||||
Ссылка в новой задаче
Block a user