提交 a74549c6 编写于 作者: J johnniang

Fix option updated event bug

上级 ae224980
......@@ -209,13 +209,7 @@ public class InstallController {
properties.put(BlogProperties.BLOG_TITLE, installParam.getTitle());
properties.put(BlogProperties.BLOG_URL, StringUtils.isBlank(installParam.getUrl()) ?
optionService.getBlogBaseUrl() : installParam.getUrl());
properties.put(PrimaryProperties.THEME, DEFAULT_THEME_ID);
properties.put(PrimaryProperties.BIRTHDAY, String.valueOf(System.currentTimeMillis()));
properties.put(EmailProperties.ENABLED, Boolean.FALSE.toString());
properties.put(CommentProperties.NEW_NOTICE, Boolean.FALSE.toString());
properties.put(CommentProperties.PASS_NOTICE, Boolean.FALSE.toString());
properties.put(CommentProperties.REPLY_NOTICE, Boolean.FALSE.toString());
properties.put(AttachmentProperties.ATTACHMENT_TYPE, AttachmentType.LOCAL.name());
// Create properties
optionService.saveProperties(properties);
......
......@@ -87,14 +87,17 @@ public class FreemarkerConfigAwareListener {
private void loadUserConfig() throws TemplateModelException {
configuration.setSharedVariable("user", userService.getCurrentUser().orElse(null));
log.debug("Loaded user");
}
private void loadOptionsConfig() throws TemplateModelException {
configuration.setSharedVariable("options", optionService.listOptions());
log.debug("Loaded options");
}
private void loadThemeConfig() throws TemplateModelException {
configuration.setSharedVariable("theme", themeService.getActivatedTheme());
configuration.setSharedVariable("settings", themeSettingService.listAsMapBy(themeService.getActivatedThemeId()));
log.debug("Loaded theme and settings");
}
}
......@@ -95,14 +95,13 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
Path themePath = themeService.getBasePath();
if (!haloProperties.isProductionEnv() || Files.notExists(themePath)) {
log.info("Copying theme folder from [{}] to [{}]", source, themePath);
FileUtils.copyFolder(source, themePath);
log.info("Copied theme folder from [{}] to [{}]", source, themePath);
} else {
log.info("Skip copying theme folder due to existence of theme folder");
log.info("Skipped copying theme folder due to existence of theme folder");
}
} catch (Exception e) {
throw new RuntimeException("Init internal theme to user path error", e);
throw new RuntimeException("Initialize internal theme to user path error", e);
}
}
......
package run.halo.app.model.properties;
import static run.halo.app.model.support.HaloConst.DEFAULT_THEME_ID;
/**
* Primary properties.
*
......@@ -8,12 +10,11 @@ package run.halo.app.model.properties;
*/
public enum PrimaryProperties implements PropertyEnum {
IS_INSTALLED("is_installed", Boolean.class, ""),
IS_INSTALLED("is_installed", Boolean.class, "false"),
THEME("theme", String.class, ""),
THEME("theme", String.class, DEFAULT_THEME_ID),
BIRTHDAY("birthday", Long.class, ""),
;
BIRTHDAY("birthday", Long.class, "");
private final String value;
......
......@@ -382,10 +382,11 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
}
private void cleanCache() {
cacheStore.delete(OptionService.OPTIONS_KEY);
cacheStore.delete(OPTIONS_KEY);
}
private void publishOptionUpdatedEvent() {
flush();
cleanCache();
eventPublisher.publishEvent(new OptionUpdatedEvent(this));
}
......
......@@ -340,8 +340,6 @@ public class ThemeServiceImpl implements ThemeService {
// Set activated theme
setActivatedTheme(themeProperty);
optionService.flush();
// Clear the cache
eventPublisher.publishEvent(new ThemeUpdatedEvent(this));
......
<!DOCTYPE html><html lang=zh-cmn-Hans><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name=robots content=noindex,nofllow><meta name=generator content=Halo><link rel=icon href=/logo.png><title>Halo Dashboard</title><link href=/css/chunk-0e9a1aaa.02508ef3.css rel=prefetch><link href=/css/chunk-0fce0b20.b63bc0c1.css rel=prefetch><link href=/css/chunk-1842ae66.b6783003.css rel=prefetch><link href=/css/chunk-237b75e4.648f80ca.css rel=prefetch><link href=/css/chunk-38995698.8b73819d.css rel=prefetch><link href=/css/chunk-3b1aebf0.8481e8b4.css rel=prefetch><link href=/css/chunk-559c36ba.c1990d7c.css rel=prefetch><link href=/css/chunk-66751b1c.19d096da.css rel=prefetch><link href=/css/chunk-6ea451b9.91f900af.css rel=prefetch><link href=/css/chunk-70d656f6.d6ed662c.css rel=prefetch><link href=/css/chunk-ae3b7b16.b2814feb.css rel=prefetch><link href=/css/chunk-bec449fa.83f70656.css rel=prefetch><link href=/css/chunk-c938f95a.09186be6.css rel=prefetch><link href=/css/chunk-ed9ea95e.a9bc9894.css rel=prefetch><link href=/css/fail.809a6bc5.css rel=prefetch><link href=/js/chunk-0ba750a2.2f39f7a0.js rel=prefetch><link href=/js/chunk-0e9a1aaa.e45cb40b.js rel=prefetch><link href=/js/chunk-0fce0b20.f7b1f673.js rel=prefetch><link href=/js/chunk-142c8832.48d4bf4f.js rel=prefetch><link href=/js/chunk-1842ae66.2893a0d3.js rel=prefetch><link href=/js/chunk-237b75e4.9823eab8.js rel=prefetch><link href=/js/chunk-28db7404.19f58fbc.js rel=prefetch><link href=/js/chunk-2d0b64bf.af87438d.js rel=prefetch><link href=/js/chunk-2d21a35c.e74c4bc5.js rel=prefetch><link href=/js/chunk-38995698.99195757.js rel=prefetch><link href=/js/chunk-3b1aebf0.8e8c9cec.js rel=prefetch><link href=/js/chunk-559c36ba.54dd287a.js rel=prefetch><link href=/js/chunk-5bf599cc.786bd397.js rel=prefetch><link href=/js/chunk-66751b1c.1bafe47e.js rel=prefetch><link href=/js/chunk-6ea451b9.188c2d5d.js rel=prefetch><link href=/js/chunk-70d656f6.8aaaba37.js rel=prefetch><link href=/js/chunk-87e2df70.1ce8b5d4.js rel=prefetch><link href=/js/chunk-ae3b7b16.06d994fc.js rel=prefetch><link href=/js/chunk-b57a30e4.249ef7a6.js rel=prefetch><link href=/js/chunk-bec449fa.3c7f5e71.js rel=prefetch><link href=/js/chunk-c938f95a.722f46d1.js rel=prefetch><link href=/js/chunk-ed9ea95e.5d5317b4.js rel=prefetch><link href=/js/fail.befc4229.js rel=prefetch><link href=/css/app.e3f1af50.css rel=preload as=style><link href=/css/chunk-vendors.454e2a41.css rel=preload as=style><link href=/js/app.42e75800.js rel=preload as=script><link href=/js/chunk-vendors.ba1aa504.js rel=preload as=script><link href=/css/chunk-vendors.454e2a41.css rel=stylesheet><link href=/css/app.e3f1af50.css rel=stylesheet></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ba1aa504.js></script><script src=/js/app.42e75800.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html lang=zh-cmn-Hans><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name=robots content=noindex,nofllow><meta name=generator content=Halo><link rel=icon href=/logo.png><title>Halo Dashboard</title><link href=/css/chunk-0e9a1aaa.02508ef3.css rel=prefetch><link href=/css/chunk-0fce0b20.b63bc0c1.css rel=prefetch><link href=/css/chunk-1842ae66.b6783003.css rel=prefetch><link href=/css/chunk-1a9e5fd6.f2a1ab27.css rel=prefetch><link href=/css/chunk-38995698.8b73819d.css rel=prefetch><link href=/css/chunk-3b1aebf0.8481e8b4.css rel=prefetch><link href=/css/chunk-559c36ba.c1990d7c.css rel=prefetch><link href=/css/chunk-5cf64070.e190fb28.css rel=prefetch><link href=/css/chunk-66751b1c.19d096da.css rel=prefetch><link href=/css/chunk-70d656f6.d6ed662c.css rel=prefetch><link href=/css/chunk-ae3b7b16.b2814feb.css rel=prefetch><link href=/css/chunk-bec449fa.83f70656.css rel=prefetch><link href=/css/chunk-c938f95a.09186be6.css rel=prefetch><link href=/css/chunk-ed9ea95e.6f053d75.css rel=prefetch><link href=/css/fail.809a6bc5.css rel=prefetch><link href=/js/chunk-0ba750a2.0d170937.js rel=prefetch><link href=/js/chunk-0e9a1aaa.1881ccc9.js rel=prefetch><link href=/js/chunk-0fce0b20.a3026806.js rel=prefetch><link href=/js/chunk-142c8832.7d835aa9.js rel=prefetch><link href=/js/chunk-1842ae66.6e9112b0.js rel=prefetch><link href=/js/chunk-1a9e5fd6.fa0f576c.js rel=prefetch><link href=/js/chunk-28db7404.656982ea.js rel=prefetch><link href=/js/chunk-2d0b64bf.00f0ca35.js rel=prefetch><link href=/js/chunk-2d21a35c.692a15b0.js rel=prefetch><link href=/js/chunk-38995698.6f1a256b.js rel=prefetch><link href=/js/chunk-3b1aebf0.6d76a86f.js rel=prefetch><link href=/js/chunk-559c36ba.6927c28a.js rel=prefetch><link href=/js/chunk-5bf599cc.70b0e978.js rel=prefetch><link href=/js/chunk-5cf64070.f296599d.js rel=prefetch><link href=/js/chunk-66751b1c.f6023b8c.js rel=prefetch><link href=/js/chunk-70d656f6.eef13ba5.js rel=prefetch><link href=/js/chunk-87e2df70.a2342fdd.js rel=prefetch><link href=/js/chunk-ae3b7b16.c7d73887.js rel=prefetch><link href=/js/chunk-b57a30e4.099a5953.js rel=prefetch><link href=/js/chunk-bec449fa.d0064f92.js rel=prefetch><link href=/js/chunk-c938f95a.df72ba72.js rel=prefetch><link href=/js/chunk-ed9ea95e.ed523470.js rel=prefetch><link href=/js/fail.86aca829.js rel=prefetch><link href=/css/app.9783d8cc.css rel=preload as=style><link href=/css/chunk-vendors.454e2a41.css rel=preload as=style><link href=/js/app.90b1dd93.js rel=preload as=script><link href=/js/chunk-vendors.ddc041b6.js rel=preload as=script><link href=/css/chunk-vendors.454e2a41.css rel=stylesheet><link href=/css/app.9783d8cc.css rel=stylesheet></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ddc041b6.js></script><script src=/js/app.90b1dd93.js></script></body></html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册