Return empty list of channels when requesting more channels at the end of cursor (#21557)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b93a013934
Коммит
79e4959d02
@@ -1110,10 +1110,6 @@ func (s SqlChannelStore) GetChannelsWithCursor(teamId string, userId string, opt
|
||||
return nil, errors.Wrapf(err, "failed to get channels with TeamId=%s and UserId=%s", teamId, userId)
|
||||
}
|
||||
|
||||
if len(channels) == 0 {
|
||||
return nil, store.NewErrNotFound("Channel", "userId="+userId)
|
||||
}
|
||||
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -3566,6 +3566,22 @@ func testChannelStoreGetChannelsWithCursor(t *testing.T, ss store.Store) {
|
||||
require.Len(t, list, 1)
|
||||
require.Equal(t, teamID, list[0].TeamId, "incorrect teamID")
|
||||
|
||||
// all channels should be returned
|
||||
list, nErr = ss.Channel().GetChannelsWithCursor(o1.TeamId, m1.UserId, &model.ChannelSearchOpts{
|
||||
IncludeDeleted: false,
|
||||
LastDeleteAt: 0,
|
||||
}, "")
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, list, 3)
|
||||
|
||||
// should return empty list
|
||||
list, nErr = ss.Channel().GetChannelsWithCursor(o1.TeamId, m1.UserId, &model.ChannelSearchOpts{
|
||||
IncludeDeleted: false,
|
||||
LastDeleteAt: 0,
|
||||
}, list[2].Id)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, list, 0)
|
||||
|
||||
// Sleeping to guarantee that the
|
||||
// UpdateAt is different.
|
||||
// The proper way would be to set UpdateAt during channel creation itself,
|
||||
|
||||
Ссылка в новой задаче
Block a user