MM-16783 Migrate "Team.UserBelongsToTeams" to Sync by default (#11589)

* Migrated UserBelongsToTeams to a syncronous method

* Updated the Store interface

* Updated calls and removed now obsolete wrapper

* Regenerated store mocks

* Reverted wrong method call
Этот коммит содержится в:
Tim Scheuermann
2019-07-08 23:03:23 +02:00
коммит произвёл Jesús Espino
родитель 1640702d5e
Коммит 902521f7d3
4 изменённых файлов: 33 добавлений и 35 удалений

Просмотреть файл

@@ -2086,7 +2086,7 @@ func (a *App) UserCanSeeOtherUser(userId string, otherUserId string) (bool, *mod
}
if len(restrictions.Teams) > 0 {
result, err := a.userBelongsToTeams(otherUserId, restrictions.Teams)
result, err := a.Srv.Store.Team().UserBelongsToTeams(otherUserId, restrictions.Teams)
if err != nil {
return false, err
}
@@ -2108,14 +2108,6 @@ func (a *App) UserCanSeeOtherUser(userId string, otherUserId string) (bool, *mod
return false, nil
}
func (a *App) userBelongsToTeams(userId string, teamIds []string) (bool, *model.AppError) {
result := <-a.Srv.Store.Team().UserBelongsToTeams(userId, teamIds)
if result.Err != nil {
return false, result.Err
}
return result.Data.(bool), nil
}
func (a *App) userBelongsToChannels(userId string, channelIds []string) (bool, *model.AppError) {
return a.Srv.Store.Channel().UserBelongsToChannels(userId, channelIds)
}