mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-55304] Migrate "server/channels/store/searchlayer/user_layer.go" to use GenericStoreResult (#25351)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
This commit is contained in:
parent
620acc029a
commit
5f8133254d
@ -115,17 +115,17 @@ func (s *SearchUserStore) autocompleteUsersInChannelByEngine(engine searchengine
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
uchan := make(chan store.StoreResult, 1)
|
uchan := make(chan store.GenericStoreResult[[]*model.User], 1)
|
||||||
go func() {
|
go func() {
|
||||||
users, nErr := s.UserStore.GetProfileByIds(context.Background(), uchanIds, nil, false)
|
users, nErr := s.UserStore.GetProfileByIds(context.Background(), uchanIds, nil, false)
|
||||||
uchan <- store.StoreResult{Data: users, NErr: nErr}
|
uchan <- store.GenericStoreResult[[]*model.User]{Data: users, NErr: nErr}
|
||||||
close(uchan)
|
close(uchan)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
nuchan := make(chan store.StoreResult, 1)
|
nuchan := make(chan store.GenericStoreResult[[]*model.User], 1)
|
||||||
go func() {
|
go func() {
|
||||||
users, nErr := s.UserStore.GetProfileByIds(context.Background(), nuchanIds, nil, false)
|
users, nErr := s.UserStore.GetProfileByIds(context.Background(), nuchanIds, nil, false)
|
||||||
nuchan <- store.StoreResult{Data: users, NErr: nErr}
|
nuchan <- store.GenericStoreResult[[]*model.User]{Data: users, NErr: nErr}
|
||||||
close(nuchan)
|
close(nuchan)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -135,15 +135,13 @@ func (s *SearchUserStore) autocompleteUsersInChannelByEngine(engine searchengine
|
|||||||
if result.NErr != nil {
|
if result.NErr != nil {
|
||||||
return nil, errors.Wrap(result.NErr, "failed to get user profiles by ids")
|
return nil, errors.Wrap(result.NErr, "failed to get user profiles by ids")
|
||||||
}
|
}
|
||||||
inUsers := result.Data.([]*model.User)
|
autocomplete.InChannel = result.Data
|
||||||
autocomplete.InChannel = inUsers
|
|
||||||
|
|
||||||
result = <-nuchan
|
result = <-nuchan
|
||||||
if result.NErr != nil {
|
if result.NErr != nil {
|
||||||
return nil, errors.Wrap(result.NErr, "failed to get user profiles by ids")
|
return nil, errors.Wrap(result.NErr, "failed to get user profiles by ids")
|
||||||
}
|
}
|
||||||
outUsers := result.Data.([]*model.User)
|
autocomplete.OutOfChannel = result.Data
|
||||||
autocomplete.OutOfChannel = outUsers
|
|
||||||
|
|
||||||
return autocomplete, nil
|
return autocomplete, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user