[FIX] EmailTemplates Edit Configurations. (#17581)

* added migration for emailTemplates.

* PUT will set the old template in the db.[walkaround]

* remove migration.
This commit is contained in:
Siddhant 2024-08-25 18:58:47 +05:30 committed by GitHub
parent 9641033d5d
commit a2c77b08b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,6 +141,21 @@ public class SystemRepository {
@Transaction
public Response createOrUpdate(Settings setting) {
Settings oldValue = getConfigWithKey(setting.getConfigType().toString());
if (oldValue != null && oldValue.getConfigType().equals(SettingsType.EMAIL_CONFIGURATION)) {
SmtpSettings configValue =
JsonUtils.convertValue(oldValue.getConfigValue(), SmtpSettings.class);
if (configValue != null) {
SmtpSettings.Templates templates = configValue.getTemplates();
SmtpSettings newConfigValue =
JsonUtils.convertValue(setting.getConfigValue(), SmtpSettings.class);
if (newConfigValue != null) {
newConfigValue.setTemplates(templates);
setting.setConfigValue(newConfigValue);
}
}
}
try {
updateSetting(setting);
} catch (Exception ex) {