Removed usage of members_paid/free_signup_redirect

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

- removed code using settings that are about to be removed
This commit is contained in:
Hannah Wolfe 2022-05-12 15:35:33 +01:00
parent dec6a4d72a
commit 8d30eeb515
2 changed files with 3 additions and 38 deletions

View File

@ -176,18 +176,10 @@ const createSessionFromMagicLink = async function (req, res, next) {
})
.find(sub => ['active', 'trialing'].includes(sub.status));
if (mostRecentActiveSubscription) {
if (labsService.isSet('tierWelcomePages')) {
customRedirect = mostRecentActiveSubscription.tier.welcome_page_url;
} else {
customRedirect = settingsCache.get('members_paid_signup_redirect') || '';
}
customRedirect = mostRecentActiveSubscription.tier.welcome_page_url;
} else {
if (labsService.isSet('tierWelcomePages')) {
const freeTier = await models.Product.findOne({type: 'free'});
customRedirect = freeTier && freeTier.get('welcome_page_url') || '';
} else {
customRedirect = settingsCache.get('members_free_signup_redirect') || '';
}
const freeTier = await models.Product.findOne({type: 'free'});
customRedirect = freeTier && freeTier.get('welcome_page_url') || '';
}
if (customRedirect && customRedirect !== '/') {

View File

@ -18,7 +18,6 @@ const jobsService = require('../jobs');
const VerificationTrigger = require('@tryghost/verification-trigger');
const DomainEvents = require('@tryghost/domain-events');
const {LastSeenAtUpdater} = require('@tryghost/members-events-service');
const events = require('../../lib/common/events');
const DatabaseInfo = require('@tryghost/database-info');
const messages = {
@ -74,32 +73,6 @@ module.exports = {
const createMembersApiInstance = require('./api');
const env = config.get('env');
events.on('settings.edited', async function (settingModel) {
if (labsService.isSet('multipleProducts')) {
return;
}
const key = settingModel.get('key');
const value = settingModel.get('value');
if (key === 'members_free_signup_redirect') {
try {
await models.Product.forge().query().update('welcome_page_url', value).where('type', 'free');
} catch (err) {
logging.error(err);
}
return;
}
if (key === 'members_paid_signup_redirect') {
try {
await models.Product.forge().query().update('welcome_page_url', value).where('type', 'paid');
} catch (err) {
logging.error(err);
}
return;
}
});
// @TODO Move to stripe service
if (env !== 'production') {
if (stripeService.api.configured && stripeService.api.mode === 'live') {