mirror of https://github.com/halo-dev/halo
Disallow to return some settings that aren't in theme configuration
parent
5a7b02c4aa
commit
4cd77ed829
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -115,19 +115,17 @@ public class ThemeSettingServiceImpl extends AbstractCrudService<ThemeSetting, I
|
||||||
|
|
||||||
// Build settings from user-defined
|
// Build settings from user-defined
|
||||||
themeSettings.forEach(themeSetting -> {
|
themeSettings.forEach(themeSetting -> {
|
||||||
Item item = itemMap.get(themeSetting.getKey());
|
|
||||||
|
|
||||||
|
|
||||||
// Convert data to corresponding data type
|
|
||||||
String key = themeSetting.getKey();
|
String key = themeSetting.getKey();
|
||||||
|
|
||||||
Object convertedValue = themeSetting.getValue();
|
Item item = itemMap.get(key);
|
||||||
|
|
||||||
if (item != null) {
|
if (item == null) {
|
||||||
convertedValue = item.getDataType().convertTo(themeSetting.getValue());
|
return;
|
||||||
log.debug("Converted user-defined data from [{}] to [{}], type: [{}]", themeSetting.getValue(), convertedValue, item.getDataType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
result.put(key, convertedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue