mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
🐛 Fixed pagination/duplicate posts and users appearing in admin area (#10031)
closes #10029 - allowed page option for users, posts, & tags browse - The page query param was not forwarding to the query, meaning that when the admin client requested the next page of users or posts, it would receive the first page again.
This commit is contained in:
parent
ae71f2deca
commit
e865d2218c
@ -15,6 +15,7 @@ module.exports = {
|
||||
'status',
|
||||
'limit',
|
||||
'order',
|
||||
'page',
|
||||
'debug'
|
||||
],
|
||||
validation: {
|
||||
|
@ -13,6 +13,7 @@ module.exports = {
|
||||
'fields',
|
||||
'limit',
|
||||
'order',
|
||||
'page',
|
||||
'debug'
|
||||
],
|
||||
validation: {
|
||||
|
@ -16,6 +16,7 @@ module.exports = {
|
||||
'limit',
|
||||
'status',
|
||||
'order',
|
||||
'page',
|
||||
'debug'
|
||||
],
|
||||
validation: {
|
||||
|
@ -206,6 +206,23 @@ describe('Posts API V2', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('supports usage of the page param', function (done) {
|
||||
request.get(localUtils.API.getApiQuery('posts/?page=2'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
const jsonResponse = res.body;
|
||||
should.equal(jsonResponse.meta.pagination.page, 2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('read', function () {
|
||||
|
@ -51,6 +51,18 @@ describe('Tag API V2', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('browse accepts the page parameter', function () {
|
||||
return request
|
||||
.get(localUtils.API.getApiQuery('tags/?page=2'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
should.equal(res.body.meta.pagination.page, 2);
|
||||
});
|
||||
});
|
||||
|
||||
it('read', function () {
|
||||
return request
|
||||
.get(localUtils.API.getApiQuery(`tags/${testUtils.existingData.tags[0].id}/?include=count.posts`))
|
||||
|
@ -113,6 +113,23 @@ describe('User API V2', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('supports usage of the page param', function (done) {
|
||||
request.get(localUtils.API.getApiQuery('users/?page=2'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
const jsonResponse = res.body;
|
||||
should.equal(jsonResponse.meta.pagination.page, 2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Read', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user