🐛 Fixed Ghost 4.3.0 migration that put all sites into "allow free members signup" (#12904)

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

- the migration moving `members_allow_free_signup` to `members_signup_access` was expecting a raw boolean setting value but the actual value is a string so always evaluated as truthy making all sites look like they had "allow free members signup" toggled on when generating the new setting's value
- updated to check for an explicit string value in `up` and set an explicit string value in `down`
This commit is contained in:
Kevin Ansfield 2021-04-27 15:37:41 +01:00 committed by Daniel Lockyer
parent e99d6ee9b7
commit 858f48cf9d
No known key found for this signature in database
GPG Key ID: FFBC6FA2A6F6ABC1

View File

@ -20,7 +20,7 @@ module.exports = createTransactionalMigration(
.select('value')
.first();
const migrateValue = oldSetting.value ? 'all' : 'invite';
const migrateValue = oldSetting.value === 'true' ? 'all' : 'invite';
if (newSetting) {
// new setting already exists, *update* with migrated value
@ -75,7 +75,7 @@ module.exports = createTransactionalMigration(
// this can potentially be lossy if going from "nobody" but it matches to the
// most appropriate setting available in earlier versions of Ghost
const rollbackValue = newSetting.value === 'all' ? true : false;
const rollbackValue = newSetting.value === 'all' ? 'true' : 'false';
if (oldSetting) {
logging.info('Updating `members_allow_free_signup` based on value from `members_signup_access`');