mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
🐛 Fixed malformed unsubscribe_url
in members api response (#21437)
no ref
This commit is contained in:
parent
2b2981205e
commit
00bd31a718
3 changed files with 11 additions and 9 deletions
|
@ -60,7 +60,7 @@ exports[`Members API - member attribution Can read member attributed to a page 2
|
|||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "1082",
|
||||
"content-length": "1094",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
|
@ -129,7 +129,7 @@ exports[`Members API - member attribution Can read member attributed to a post 2
|
|||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "1065",
|
||||
"content-length": "1077",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
|
@ -198,7 +198,7 @@ exports[`Members API - member attribution Can read member attributed to a tag 2:
|
|||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "1071",
|
||||
"content-length": "1083",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
|
@ -267,7 +267,7 @@ exports[`Members API - member attribution Can read member attributed to an autho
|
|||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "1053",
|
||||
"content-length": "1065",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
|
@ -336,7 +336,7 @@ exports[`Members API - member attribution Can read member attributed to an url 2
|
|||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "1049",
|
||||
"content-length": "1061",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
|
|
|
@ -249,7 +249,7 @@ module.exports = class MemberBREADService {
|
|||
info: suppressionData.info
|
||||
};
|
||||
|
||||
const unsubscribeUrl = this.settingsHelpers.createUnsubscribeUrl(member.id);
|
||||
const unsubscribeUrl = this.settingsHelpers.createUnsubscribeUrl(member.uuid);
|
||||
member.unsubscribe_url = unsubscribeUrl;
|
||||
|
||||
return member;
|
||||
|
@ -432,7 +432,7 @@ module.exports = class MemberBREADService {
|
|||
suppressed: bulkSuppressionData[index].suppressed || !!model.get('email_disabled'),
|
||||
info: bulkSuppressionData[index].info
|
||||
};
|
||||
member.unsubscribe_url = this.settingsHelpers.createUnsubscribeUrl(member.id);
|
||||
member.unsubscribe_url = this.settingsHelpers.createUnsubscribeUrl(member.uuid);
|
||||
return member;
|
||||
});
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ const moment = require('moment');
|
|||
describe('MemberBreadService', function () {
|
||||
describe('read', function () {
|
||||
const MEMBER_ID = 123;
|
||||
const MEMBER_UUID = 'abcd-efgh';
|
||||
const DEFAULT_RELATIONS = [
|
||||
'labels',
|
||||
'stripeSubscriptions',
|
||||
|
@ -27,7 +28,7 @@ describe('MemberBreadService', function () {
|
|||
const getService = () => {
|
||||
return new MemberBreadService({
|
||||
settingsHelpers: {
|
||||
createUnsubscribeUrl: sinon.stub().returns('https://example.com/unsubscribe/?uuid=123&key=456')
|
||||
createUnsubscribeUrl: sinon.stub().callsFake(uuid => `https://example.com/unsubscribe/?uuid=${uuid}&key=456`)
|
||||
},
|
||||
memberRepository: memberRepositoryStub,
|
||||
memberAttributionService: memberAttributionServiceStub,
|
||||
|
@ -38,6 +39,7 @@ describe('MemberBreadService', function () {
|
|||
beforeEach(function () {
|
||||
memberModelJSON = {
|
||||
id: MEMBER_ID,
|
||||
uuid: MEMBER_UUID,
|
||||
name: 'foo bar',
|
||||
email: 'foo@bar.baz',
|
||||
subscriptions: []
|
||||
|
@ -294,7 +296,7 @@ describe('MemberBreadService', function () {
|
|||
const memberBreadService = getService();
|
||||
const member = await memberBreadService.read({id: MEMBER_ID});
|
||||
|
||||
assert.equal(member.unsubscribe_url, 'https://example.com/unsubscribe/?uuid=123&key=456');
|
||||
assert.equal(member.unsubscribe_url, `https://example.com/unsubscribe/?uuid=${MEMBER_UUID}&key=456`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue