mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed members list query not always matching route params
refs e25e36352d
- referenced refactor accidentally removed direct usage of `params` in `fetchMembersTask()`
- because it's called from the `model()` hook the query param properties on `this` have not yet been updated to the new params meaning we were querying the API with stale params
This commit is contained in:
parent
ee5da7a5d2
commit
51b0cfb199
2 changed files with 4 additions and 2 deletions
|
@ -143,8 +143,8 @@ export default class MembersController extends Controller {
|
|||
return !!(this.label || this.paidParam || this.searchParam);
|
||||
}
|
||||
|
||||
getApiQueryObject({extraFilters = []} = {}) {
|
||||
let {label, paidParam, searchParam} = this;
|
||||
getApiQueryObject({params, extraFilters = []} = {}) {
|
||||
let {label, paidParam, searchParam} = params ? params : this;
|
||||
|
||||
let filters = [];
|
||||
|
||||
|
@ -301,6 +301,7 @@ export default class MembersController extends Controller {
|
|||
|
||||
this.members = yield this.ellaSparse.array((range = {}, query = {}) => {
|
||||
const searchQuery = this.getApiQueryObject({
|
||||
params,
|
||||
extraFilters: [`created_at:<='${moment.utc(this._startDate).format('YYYY-MM-DD HH:mm:ss')}'`]
|
||||
});
|
||||
const order = orderParam ? `${orderParam} desc` : `created_at desc`;
|
||||
|
|
|
@ -185,6 +185,7 @@ describe('Acceptance: Members', function () {
|
|||
// members filter is reset
|
||||
// TODO: fix query params reset for empty strings
|
||||
expect(currentURL()).to.equal('/members?search=');
|
||||
expect(findAll('[data-test-member]').length).to.equal(6);
|
||||
|
||||
await click('[data-test-button="close-modal"]');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue