Channel.GetTeamChannels to sync by default (#11211)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
7d08efc335
Коммит
a7278169d2
@@ -1697,11 +1697,11 @@ func (a *App) RemoveUserFromChannel(userIdToRemove string, removerUserId string,
|
||||
|
||||
func (a *App) GetNumberOfChannelsOnTeam(teamId string) (int, *model.AppError) {
|
||||
// Get total number of channels on current team
|
||||
result := <-a.Srv.Store.Channel().GetTeamChannels(teamId)
|
||||
if result.Err != nil {
|
||||
return 0, result.Err
|
||||
list, err := a.Srv.Store.Channel().GetTeamChannels(teamId)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return len(*result.Data.(*model.ChannelList)), nil
|
||||
return len(*list), nil
|
||||
}
|
||||
|
||||
func (a *App) SetActiveChannel(userId string, channelId string) *model.AppError {
|
||||
|
||||
@@ -1070,12 +1070,11 @@ func (a *App) PermanentDeleteTeam(team *model.Team) *model.AppError {
|
||||
return err
|
||||
}
|
||||
|
||||
if result := <-a.Srv.Store.Channel().GetTeamChannels(team.Id); result.Err != nil {
|
||||
if result.Err.Id != "store.sql_channel.get_channels.not_found.app_error" {
|
||||
return result.Err
|
||||
if channels, err := a.Srv.Store.Channel().GetTeamChannels(team.Id); err != nil {
|
||||
if err.Id != "store.sql_channel.get_channels.not_found.app_error" {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
channels := result.Data.(*model.ChannelList)
|
||||
for _, c := range *channels {
|
||||
a.PermanentDeleteChannel(c)
|
||||
}
|
||||
|
||||
@@ -2142,12 +2142,12 @@ func (a *App) GetViewUsersRestrictionsForTeam(userId string, teamId string) ([]s
|
||||
func (a *App) getListOfAllowedChannelsForTeam(teamId string, viewRestrictions *model.ViewUsersRestrictions) ([]string, *model.AppError) {
|
||||
var listOfAllowedChannels []string
|
||||
if viewRestrictions == nil || strings.Contains(strings.Join(viewRestrictions.Teams, "."), teamId) {
|
||||
result := <-a.Srv.Store.Channel().GetTeamChannels(teamId)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
channels, err := a.Srv.Store.Channel().GetTeamChannels(teamId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
channelIds := []string{}
|
||||
for _, channel := range *result.Data.(*model.ChannelList) {
|
||||
for _, channel := range *channels {
|
||||
channelIds = append(channelIds, channel.Id)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user