mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-19 10:12:47 +08:00
Fix unrelated flaky test
This commit is contained in:
@@ -204,9 +204,16 @@ func (s SearchFileInfoStore) Search(rctx request.CTX, paramsList []*model.Search
|
||||
if nErr != nil {
|
||||
return nil, nErr
|
||||
}
|
||||
filesMap := make(map[string]*model.FileInfo, len(files))
|
||||
for _, f := range files {
|
||||
filesList.AddFileInfo(f)
|
||||
filesList.AddOrder(f.Id)
|
||||
filesMap[f.Id] = f
|
||||
}
|
||||
// Iterate over fileIds to preserve the search engine's ranking order.
|
||||
for _, id := range fileIds {
|
||||
if f, ok := filesMap[id]; ok {
|
||||
filesList.AddFileInfo(f)
|
||||
filesList.AddOrder(f.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
return filesList, nil
|
||||
|
||||
@@ -180,8 +180,14 @@ func (s SearchPostStore) searchPostsForUserByEngine(engine searchengine.SearchEn
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
postsMap := make(map[string]*model.Post, len(posts))
|
||||
for _, p := range posts {
|
||||
if p.DeleteAt == 0 {
|
||||
postsMap[p.Id] = p
|
||||
}
|
||||
// Iterate over postIds to preserve the search engine's ranking order.
|
||||
for _, id := range postIds {
|
||||
p, ok := postsMap[id]
|
||||
if ok && p.DeleteAt == 0 {
|
||||
postList.AddPost(p)
|
||||
postList.AddOrder(p.Id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user