MM-45723: Include DM/GM channels for user indexing (#21391)
There were 2 separate issues here: 1. We were excluding DM/GM channels for user indexing. Not sure why. This prevented users to be shown as channel members in autocomplete results in both Bleve and Elasticsearch. 2. We were incorrectly deciding to search across the team based on if the current channel is in the list of allowed channels or not. But we were incorrectly wiping the list of allowed channels even if a channelid was passed. This makes it work same as a DB search. One catch is that for the correct results to appear, a re-indexing is required. ```release-note Autocompletion results using Elasticsearch or Bleve will correctly show a user as a channel member in DM/GM channels. To force this change to appear, a re-indexing will be necessary. ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
28698abb9f
Коммит
10a627fac1
@@ -4912,10 +4912,35 @@ func testUserStoreGetUsersBatchForIndexing(t *testing.T, ss store.Store) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
cDM := &model.Channel{
|
||||
Name: model.NewId() + "__" + model.NewId(),
|
||||
Type: model.ChannelTypeDirect,
|
||||
}
|
||||
cm1 := &model.ChannelMember{
|
||||
UserId: u3.Id,
|
||||
ChannelId: cDM.Id,
|
||||
NotifyProps: model.GetDefaultChannelNotifyProps(),
|
||||
}
|
||||
cm2 := &model.ChannelMember{
|
||||
UserId: u2.Id,
|
||||
ChannelId: cDM.Id,
|
||||
NotifyProps: model.GetDefaultChannelNotifyProps(),
|
||||
}
|
||||
cDM, nErr = ss.Channel().SaveDirectChannel(cDM, cm1, cm2)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Getting all users
|
||||
res1List, err := ss.User().GetUsersBatchForIndexing(u1.CreateAt-1, "", 100)
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, res1List, 3)
|
||||
for _, user := range res1List {
|
||||
switch user.Id {
|
||||
case u2.Id:
|
||||
assert.ElementsMatch(t, user.ChannelsIds, []string{cPub1.Id, cPub2.Id, cDM.Id})
|
||||
case u3.Id:
|
||||
assert.ElementsMatch(t, user.ChannelsIds, []string{cPub2.Id, cDM.Id})
|
||||
}
|
||||
}
|
||||
|
||||
// Testing pagination
|
||||
res2List, err := ss.User().GetUsersBatchForIndexing(u1.CreateAt-1, "", 1)
|
||||
|
||||
Ссылка в новой задаче
Block a user