Disallow to return some settings that aren't in theme configuration

pull/146/head
johnniang 2019-04-21 09:32:08 +08:00
parent 5a7b02c4aa
commit 4cd77ed829
2 changed files with 25 additions and 8 deletions

View File

@ -0,0 +1,19 @@
package run.halo.app.event;
import org.springframework.context.ApplicationEvent;
/**
* @author johnniang
* @date 19-4-20
*/
public class LogEvent extends ApplicationEvent {
/**
* Create a new ApplicationEvent.
*
* @param source the object on which the event initially occurred (never {@code null})
*/
public LogEvent(Object source) {
super(source);
}
}

View File

@ -115,19 +115,17 @@ public class ThemeSettingServiceImpl extends AbstractCrudService<ThemeSetting, I
// Build settings from user-defined
themeSettings.forEach(themeSetting -> {
Item item = itemMap.get(themeSetting.getKey());
// Convert data to corresponding data type
String key = themeSetting.getKey();
Object convertedValue = themeSetting.getValue();
Item item = itemMap.get(key);
if (item != null) {
convertedValue = item.getDataType().convertTo(themeSetting.getValue());
log.debug("Converted user-defined data from [{}] to [{}], type: [{}]", themeSetting.getValue(), convertedValue, item.getDataType());
if (item == null) {
return;
}
Object convertedValue = item.getDataType().convertTo(themeSetting.getValue());
log.debug("Converted user-defined data from [{}] to [{}], type: [{}]", themeSetting.getValue(), convertedValue, item.getDataType());
result.put(key, convertedValue);
});