MM-16579 Migrate User.GetChannelGroupUsers to Sync by default (#11412)
* Migrate User.GetChannelGroupUsers to Sync by default * Directly return Store results
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
cb7c549c7b
Коммит
44b9fe3110
@@ -1671,28 +1671,24 @@ func (us SqlUserStore) GetTeamGroupUsers(teamID string) store.StoreChannel {
|
||||
})
|
||||
}
|
||||
|
||||
func (us SqlUserStore) GetChannelGroupUsers(channelID string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
query := applyChannelGroupConstrainedFilter(us.usersQuery, channelID)
|
||||
func (us SqlUserStore) GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError) {
|
||||
query := applyChannelGroupConstrainedFilter(us.usersQuery, channelID)
|
||||
|
||||
queryString, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.GetChannelGroupUsers", "store.sql_user.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
queryString, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlUserStore.GetChannelGroupUsers", "store.sql_user.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
var users []*model.User
|
||||
if _, err := us.GetReplica().Select(&users, queryString, args...); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.GetChannelGroupUsers", "store.sql_user.get_profiles.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
var users []*model.User
|
||||
if _, err := us.GetReplica().Select(&users, queryString, args...); err != nil {
|
||||
return nil, model.NewAppError("SqlUserStore.GetChannelGroupUsers", "store.sql_user.get_profiles.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
for _, u := range users {
|
||||
u.Sanitize(map[string]bool{})
|
||||
}
|
||||
for _, u := range users {
|
||||
u.Sanitize(map[string]bool{})
|
||||
}
|
||||
|
||||
result.Data = users
|
||||
})
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func applyViewRestrictionsFilter(query sq.SelectBuilder, restrictions *model.ViewUsersRestrictions, distinct bool) sq.SelectBuilder {
|
||||
|
||||
Ссылка в новой задаче
Block a user