Fixed members CSV export not filtering on subscribed (#14721)

refs https://ghost.slack.com/archives/C02G9E68C/p1651851268912299?thread_ts=1651848216.832419&cid=C02G9E68C

- When exporting members to CSV the subscribed filter was not working correctly
- Fixed by also applying the NQL mapping to the export endpoint
- This also changes the order of the members in the CSV export to match the order in admin/browse endpoint
This commit is contained in:
Simon Backx 2022-05-09 10:56:36 +02:00 committed by GitHub
parent 7d951f96f0
commit 96e7187e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -47,6 +47,12 @@ module.exports = {
this.browse(...arguments); this.browse(...arguments);
}, },
exportCSV() {
debug('exportCSV');
this.browse(...arguments);
},
add(apiConfig, frame) { add(apiConfig, frame) {
debug('add'); debug('add');
if (frame.data.members[0].labels) { if (frame.data.members[0].labels) {

View File

@ -1543,7 +1543,7 @@ describe('Members API', function () {
it('Can export CSV', async function () { it('Can export CSV', async function () {
const res = await agent const res = await agent
.get(`/members/upload/`) .get(`/members/upload/?limit=all`)
.expectStatus(200) .expectStatus(200)
.expectEmptyBody() // express-test body parsing doesn't support CSV .expectEmptyBody() // express-test body parsing doesn't support CSV
.matchHeaderSnapshot({ .matchHeaderSnapshot({