Added email_suppression property to response for PUT api/member method (#15946)

closes TryGhost/Team#2359
- Keep the same response structure for `api/member` GET and PUT methods
This commit is contained in:
Elena Baidakova 2022-12-06 13:51:26 +04:00 committed by GitHub
parent 0ab652b768
commit 62681037f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View File

@ -180,9 +180,10 @@ const updateMemberData = async function (req, res) {
id: member.id, id: member.id,
withRelated: ['stripeSubscriptions', 'stripeSubscriptions.customer', 'stripeSubscriptions.stripePrice', 'newsletters'] withRelated: ['stripeSubscriptions', 'stripeSubscriptions.customer', 'stripeSubscriptions.stripePrice', 'newsletters']
}; };
const updatedMember = await membersService.api.members.update(data, options); await membersService.api.members.update(data, options);
const updatedMember = await membersService.ssr.getMemberDataFromSession(req, res);
res.json(formattedMemberResponse(updatedMember.toJSON())); res.json(formattedMemberResponse(updatedMember));
} else { } else {
res.json(null); res.json(null);
} }

View File

@ -49,6 +49,10 @@ exports[`Comments API when authenticated can update comment notifications 1: [bo
Object { Object {
"avatar_image": null, "avatar_image": null,
"email": "member@example.com", "email": "member@example.com",
"email_suppression": Object {
"info": null,
"suppressed": false,
},
"enable_comment_notifications": false, "enable_comment_notifications": false,
"expertise": "test", "expertise": "test",
"firstname": "Test", "firstname": "Test",
@ -78,7 +82,7 @@ exports[`Comments API when authenticated can update comment notifications 2: [he
Object { Object {
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "448", "content-length": "501",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Encoding", "vary": "Accept-Encoding",
@ -209,6 +213,10 @@ exports[`Comments API when authenticated can update member expertise 1: [body] 1
Object { Object {
"avatar_image": null, "avatar_image": null,
"email": "member@example.com", "email": "member@example.com",
"email_suppression": Object {
"info": null,
"suppressed": false,
},
"enable_comment_notifications": true, "enable_comment_notifications": true,
"expertise": "Head of Testing", "expertise": "Head of Testing",
"firstname": null, "firstname": null,
@ -238,7 +246,7 @@ exports[`Comments API when authenticated can update member expertise 2: [headers
Object { Object {
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "449", "content-length": "502",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Encoding", "vary": "Accept-Encoding",
@ -250,6 +258,10 @@ exports[`Comments API when authenticated can update name 1: [body] 1`] = `
Object { Object {
"avatar_image": null, "avatar_image": null,
"email": "member@example.com", "email": "member@example.com",
"email_suppression": Object {
"info": null,
"suppressed": false,
},
"enable_comment_notifications": true, "enable_comment_notifications": true,
"expertise": "test", "expertise": "test",
"firstname": "Test", "firstname": "Test",
@ -279,7 +291,7 @@ exports[`Comments API when authenticated can update name 2: [headers] 1`] = `
Object { Object {
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "447", "content-length": "500",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Encoding", "vary": "Accept-Encoding",
@ -332,6 +344,10 @@ exports[`Comments API when authenticated trims whitespace from expertise 1: [bod
Object { Object {
"avatar_image": null, "avatar_image": null,
"email": "member@example.com", "email": "member@example.com",
"email_suppression": Object {
"info": null,
"suppressed": false,
},
"enable_comment_notifications": true, "enable_comment_notifications": true,
"expertise": "test", "expertise": "test",
"firstname": null, "firstname": null,
@ -361,7 +377,7 @@ exports[`Comments API when authenticated trims whitespace from expertise 2: [hea
Object { Object {
"access-control-allow-origin": "*", "access-control-allow-origin": "*",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "438", "content-length": "491",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Encoding", "vary": "Accept-Encoding",