Removed support for editing members_from_address

refs: https://github.com/TryGhost/Team/issues/1625
refs: https://github.com/TryGhost/Team/issues/1558

- the members_from_address setting is no longer used, instead we use newsletters from address
This commit is contained in:
Hannah Wolfe 2022-05-12 15:23:54 +01:00
parent 5cc7a54edc
commit cd20738d65
5 changed files with 9 additions and 12 deletions

View File

@ -57,7 +57,7 @@ module.exports = {
required: true
},
action: {
values: ['fromaddressupdate', 'supportaddressupdate']
values: ['supportaddressupdate']
}
}
},
@ -68,7 +68,6 @@ module.exports = {
const {token, action} = frame.options;
const updatedEmailAddress = await membersService.settings.getEmailFromToken({token});
const actionToKeyMapping = {
fromAddressUpdate: 'members_from_address',
supportAddressUpdate: 'members_support_address'
};
if (updatedEmailAddress) {

View File

@ -59,7 +59,7 @@ module.exports = {
});
}
if (!type || !['fromAddressUpdate', 'supportAddressUpdate'].includes(type)) {
if (!type || !['supportAddressUpdate'].includes(type)) {
throw new BadRequestError({
message: messages.invalidEmailTypeReceived
});

View File

@ -69,7 +69,7 @@ function createSettingsInstance(config) {
getSubject
});
const sendEmailAddressUpdateMagicLink = ({email, type = 'fromAddressUpdate'}) => {
const sendEmailAddressUpdateMagicLink = ({email, type = 'supportAddressUpdate'}) => {
const [,toDomain] = email.split('@');
let fromEmail = `noreply@${toDomain}`;
if (fromEmail === email) {
@ -99,9 +99,7 @@ function createSettingsInstance(config) {
const getAdminRedirectLink = ({type}) => {
const adminUrl = urlUtils.urlFor('admin', true);
if (type === 'fromAddressUpdate') {
return urlUtils.urlJoin(adminUrl, `#/settings/members-email/?${type}=success`);
} else if (type === 'supportAddressUpdate') {
if (type === 'supportAddressUpdate') {
return urlUtils.urlJoin(adminUrl, `#/settings/members/?${type}=success`);
} else {
return urlUtils.urlJoin(adminUrl, `#/site/`);

View File

@ -1153,9 +1153,9 @@ exports[`Settings API can do validateMembersEmailUpdate 1: [headers] 1`] = `
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": "101",
"content-length": "98",
"content-type": "text/plain; charset=utf-8",
"location": "http://127.0.0.1:2369/ghost/#/settings/members-email/?fromAddressUpdate=success",
"location": "http://127.0.0.1:2369/ghost/#/settings/members/?supportAddressUpdate=success",
"vary": "Origin, Accept, Accept-Encoding",
"x-powered-by": "Express",
}

View File

@ -169,7 +169,7 @@ describe('Settings API', function () {
.post('settings/members/email/')
.body({
email: 'test@test.com',
type: 'fromAddressUpdate'
type: 'supportAddressUpdate'
})
.expectStatus(204)
.expectEmptyBody()
@ -187,7 +187,7 @@ describe('Settings API', function () {
// @TODO Fixing https://github.com/TryGhost/Team/issues/584 should result in this test changing
await agent
.get(`settings/members/email/?token=${token}&action=fromAddressUpdate`)
.get(`settings/members/email/?token=${token}&action=supportAddressUpdate`)
.expectStatus(302)
.expectEmptyBody()
.matchHeaderSnapshot();
@ -197,7 +197,7 @@ describe('Settings API', function () {
await agent.get('settings/')
.expect(({body}) => {
const fromAddress = body.settings.find((setting) => {
return setting.key === 'members_from_address';
return setting.key === 'members_support_address';
});
assert.equal(fromAddress.value, 'test@test.com');
});