mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
🐛 Fixed ignored created_at and subscribed fields in Members API
closes #12156 - When adding new member through `POST /members` API or importing members with CSV importer `POST /members/upload` API created_at and subscribed were ignored - Similar problem but only with `subscribed` field was present in `PUT /members/:id` API - The regression was introduced with a bump of @tryghost/members-api to 0.26.0, specifically this change in upstream -a28bcc5b2a (diff-3daeef67d07a2a0f94c89a86cafcede9R44)
- Bumped @tryghost/members-api package to 0.28.2 fixing the underlying issue -7b5f2e3cb7
This commit is contained in:
parent
679616026f
commit
b8197023b3
2 changed files with 44 additions and 6 deletions
|
@ -136,7 +136,10 @@ describe('Members API', function () {
|
|||
it('Can add', function () {
|
||||
const member = {
|
||||
name: 'test',
|
||||
email: 'memberTestAdd@test.com'
|
||||
email: 'memberTestAdd@test.com',
|
||||
note: 'test note',
|
||||
subscribed: false,
|
||||
labels: ['test-label']
|
||||
};
|
||||
|
||||
return request
|
||||
|
@ -155,6 +158,12 @@ describe('Members API', function () {
|
|||
|
||||
jsonResponse.members[0].name.should.equal(member.name);
|
||||
jsonResponse.members[0].email.should.equal(member.email);
|
||||
jsonResponse.members[0].note.should.equal(member.note);
|
||||
jsonResponse.members[0].subscribed.should.equal(member.subscribed);
|
||||
testUtils.API.isISO8601(jsonResponse.members[0].created_at).should.be.true();
|
||||
|
||||
jsonResponse.members[0].labels.length.should.equal(1);
|
||||
jsonResponse.members[0].labels[0].name.should.equal('test-label');
|
||||
})
|
||||
.then(() => {
|
||||
return request
|
||||
|
@ -170,12 +179,16 @@ describe('Members API', function () {
|
|||
it('Can edit by id', function () {
|
||||
const memberToChange = {
|
||||
name: 'change me',
|
||||
email: 'member2Change@test.com'
|
||||
email: 'member2Change@test.com',
|
||||
note: 'initial note',
|
||||
subscribed: true
|
||||
};
|
||||
|
||||
const memberChanged = {
|
||||
name: 'changed',
|
||||
email: 'cantChangeMe@test.com'
|
||||
email: 'cantChangeMe@test.com',
|
||||
note: 'edited note',
|
||||
subscribed: false
|
||||
};
|
||||
|
||||
return request
|
||||
|
@ -214,6 +227,8 @@ describe('Members API', function () {
|
|||
jsonResponse.members[0].name.should.equal(memberChanged.name);
|
||||
jsonResponse.members[0].email.should.equal(memberChanged.email);
|
||||
jsonResponse.members[0].email.should.not.equal(memberToChange.email);
|
||||
jsonResponse.members[0].note.should.equal(memberChanged.note);
|
||||
jsonResponse.members[0].subscribed.should.equal(memberChanged.subscribed);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -353,6 +368,29 @@ describe('Members API', function () {
|
|||
should.exist(jsonResponse);
|
||||
should.exist(jsonResponse.members);
|
||||
jsonResponse.members.should.have.length(2);
|
||||
|
||||
const importedMember1 = jsonResponse.members.find(m => m.email === 'jbloggs@example.com');
|
||||
should.exist(importedMember1);
|
||||
importedMember1.name.should.equal('joe');
|
||||
should(importedMember1.note).equal(null);
|
||||
importedMember1.subscribed.should.equal(true);
|
||||
importedMember1.labels.length.should.equal(1);
|
||||
testUtils.API.isISO8601(importedMember1.created_at).should.be.true();
|
||||
importedMember1.comped.should.equal(false);
|
||||
importedMember1.stripe.should.not.be.undefined();
|
||||
importedMember1.stripe.subscriptions.length.should.equal(0);
|
||||
|
||||
const importedMember2 = jsonResponse.members.find(m => m.email === 'test@example.com');
|
||||
should.exist(importedMember2);
|
||||
importedMember2.name.should.equal('test');
|
||||
should(importedMember2.note).equal('test note');
|
||||
importedMember2.subscribed.should.equal(false);
|
||||
importedMember2.labels.length.should.equal(2);
|
||||
testUtils.API.isISO8601(importedMember2.created_at).should.be.true();
|
||||
importedMember2.created_at.should.equal('1991-10-02T20:30:31.000Z');
|
||||
importedMember2.comped.should.equal(false);
|
||||
importedMember2.stripe.should.not.be.undefined();
|
||||
importedMember2.stripe.subscriptions.length.should.equal(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
email,name,subscribed_to_emails,created_at
|
||||
jbloggs@example.com,joe,true,
|
||||
test@example.com,test,false,"1991-10-02T20:30:31.000Z"
|
||||
email,name,note,subscribed_to_emails,labels,created_at
|
||||
jbloggs@example.com,joe,,true,,
|
||||
test@example.com,test,"test note",false,"test-label","1991-10-02T20:30:31.000Z"
|
||||
|
|
|
Loading…
Add table
Reference in a new issue