Return 400 error if limit_after is zero (#15049)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aae3b9650f
Коммит
484e813dca
@@ -1696,8 +1696,14 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
require.Equal(t, namePost(expected.PrevPostId), namePost(actual.PrevPostId), "unexpected prev post id")
|
||||
}
|
||||
|
||||
// Setting limit_after to zero should fail with a 400 BadRequest.
|
||||
posts, resp := Client.GetPostsAroundLastUnread(userId, channelId, 20, 0)
|
||||
require.Error(t, resp.Error)
|
||||
require.Equal(t, "api.context.invalid_url_param.app_error", resp.Error.Id)
|
||||
require.Equal(t, http.StatusBadRequest, resp.StatusCode)
|
||||
|
||||
// All returned posts are all read by the user, since it's created by the user itself.
|
||||
posts, resp := Client.GetPostsAroundLastUnread(userId, channelId, 20, 20)
|
||||
posts, resp = Client.GetPostsAroundLastUnread(userId, channelId, 20, 20)
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, posts.Order, 12, "Should return 12 posts only since there's no unread post")
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user