Minor - don't perform registration settings migration if old path doesn't exist

- Migration was otherwise performed if config.yml was blank, which produces confusing output
This commit is contained in:
ljacqu 2017-01-22 13:14:26 +01:00
parent e17b1f0fdf
commit 56017c81d0

View File

@ -228,11 +228,12 @@ public class SettingsMigrationService extends PlainMigrationService {
} }
private static boolean convertToRegistrationType(PropertyResource resource) { private static boolean convertToRegistrationType(PropertyResource resource) {
if (RegistrationSettings.REGISTRATION_TYPE.isPresent(resource)) { String oldEmailRegistrationPath = "settings.registration.enableEmailRegistrationSystem";
if (RegistrationSettings.REGISTRATION_TYPE.isPresent(resource) || !resource.contains(oldEmailRegistrationPath)) {
return false; return false;
} }
boolean useEmail = newProperty("settings.registration.enableEmailRegistrationSystem", false).getValue(resource); boolean useEmail = newProperty(oldEmailRegistrationPath, false).getValue(resource);
RegistrationType registrationType = useEmail ? RegistrationType.EMAIL : RegistrationType.PASSWORD; RegistrationType registrationType = useEmail ? RegistrationType.EMAIL : RegistrationType.PASSWORD;
String useConfirmationPath = useEmail String useConfirmationPath = useEmail