Migrates Channel.GetMembersForUser to sync by default (#11236)
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
1f6aedcdf3
Коммит
d17bdc6764
@@ -1301,11 +1301,7 @@ func (a *App) GetChannelMembersByIds(channelId string, userIds []string) (*model
|
||||
}
|
||||
|
||||
func (a *App) GetChannelMembersForUser(teamId string, userId string) (*model.ChannelMembers, *model.AppError) {
|
||||
result := <-a.Srv.Store.Channel().GetMembersForUser(teamId, userId)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
}
|
||||
return result.Data.(*model.ChannelMembers), nil
|
||||
return a.Srv.Store.Channel().GetMembersForUser(teamId, userId)
|
||||
}
|
||||
|
||||
func (a *App) GetChannelMembersForUserWithPagination(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError) {
|
||||
|
||||
@@ -152,19 +152,17 @@ func (job *EmailBatchingJob) checkPendingNotifications(now time.Time, handler fu
|
||||
|
||||
// if the user has viewed any channels in this team since the notification was queued, delete
|
||||
// all queued notifications
|
||||
result := <-job.server.Store.Channel().GetMembersForUser(inspectedTeamNames[notification.teamName], userId)
|
||||
if result.Err != nil {
|
||||
mlog.Error(fmt.Sprint("Unable to find ChannelMembers for user", result.Err))
|
||||
channelMembers, err := job.server.Store.Channel().GetMembersForUser(inspectedTeamNames[notification.teamName], userId)
|
||||
if err != nil {
|
||||
mlog.Error(fmt.Sprint("Unable to find ChannelMembers for user", err))
|
||||
continue
|
||||
}
|
||||
|
||||
if channelMembers, ok := result.Data.(*model.ChannelMembers); ok {
|
||||
for _, channelMember := range *channelMembers {
|
||||
if channelMember.LastViewedAt >= batchStartTime {
|
||||
mlog.Debug(fmt.Sprintf("Deleted notifications for user %s", userId), mlog.String("user_id", userId))
|
||||
delete(job.pendingNotifications, userId)
|
||||
break
|
||||
}
|
||||
for _, channelMember := range *channelMembers {
|
||||
if channelMember.LastViewedAt >= batchStartTime {
|
||||
mlog.Debug(fmt.Sprintf("Deleted notifications for user %s", userId), mlog.String("user_id", userId))
|
||||
delete(job.pendingNotifications, userId)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2198,13 +2198,13 @@ func (a *App) GetViewUsersRestrictionsForTeam(userId string, teamId string) ([]s
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
result := <-a.Srv.Store.Channel().GetMembersForUser(teamId, userId)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
members, err := a.Srv.Store.Channel().GetMembersForUser(teamId, userId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
channelIds := []string{}
|
||||
for _, membership := range *result.Data.(*model.ChannelMembers) {
|
||||
for _, membership := range *members {
|
||||
channelIds = append(channelIds, membership.ChannelId)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user