Optimise creation of DM (#16819)
* Optimise creation of dm * Handle direct channels with the same user * Cover GetMany with specs and add it on tha cache layer as well * Fix specs by handling user dming themselves * Apply PR suggestions * Apply PR suggestions * Use require.NoError instead of require.Nil on userstore test * Improve readability of GetOrCreateDirectChannel * Apply PR suggestions * Update layers Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -325,6 +325,22 @@ func (us SqlUserStore) UpdateMfaActive(userId string, active bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMany returns a list of users for the provided list of ids
|
||||
func (us SqlUserStore) GetMany(ids []string) ([]*model.User, error) {
|
||||
query := us.usersQuery.Where(sq.Eq{"Id": ids})
|
||||
queryString, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "users_get_many_tosql")
|
||||
}
|
||||
|
||||
var users []*model.User
|
||||
if _, err := us.GetReplica().Select(&users, queryString, args...); err != nil {
|
||||
return nil, errors.Wrap(err, "users_get_many_select")
|
||||
}
|
||||
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (us SqlUserStore) Get(id string) (*model.User, error) {
|
||||
query := us.usersQuery.Where("Id = ?", id)
|
||||
queryString, args, err := query.ToSql()
|
||||
|
||||
Ссылка в новой задаче
Block a user