mirror of https://github.com/halo-dev/halo
parent
2327aafc1c
commit
491ff98916
|
@ -10,6 +10,7 @@ import org.springframework.core.annotation.Order;
|
|||
import org.springframework.stereotype.Component;
|
||||
import run.halo.app.event.options.OptionUpdatedEvent;
|
||||
import run.halo.app.event.theme.ThemeActivatedEvent;
|
||||
import run.halo.app.event.theme.ThemeUpdatedEvent;
|
||||
import run.halo.app.event.user.UserUpdatedEvent;
|
||||
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
||||
import run.halo.app.model.properties.OtherProperties;
|
||||
|
@ -23,7 +24,8 @@ import run.halo.app.service.UserService;
|
|||
* Freemarker config aware listener.
|
||||
*
|
||||
* @author johnniang
|
||||
* @date 19-4-20
|
||||
* @author ryanwang
|
||||
* @date 2019-04-20
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
|
@ -68,6 +70,13 @@ public class FreemarkerConfigAwareListener {
|
|||
loadThemeConfig();
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public void onThemeUpdatedEvent(ThemeUpdatedEvent event) throws TemplateModelException {
|
||||
log.debug("Received theme updated event");
|
||||
|
||||
loadThemeConfig();
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public void onUserUpdate(UserUpdatedEvent event) throws TemplateModelException {
|
||||
log.debug("Received user updated event, user id: [{}]", event.getUserId());
|
||||
|
|
|
@ -597,6 +597,8 @@ public class ThemeServiceImpl implements ThemeService {
|
|||
// Coping new theme files to old theme folder.
|
||||
FileUtils.copyFolder(preparePath, Paths.get(updatingTheme.getThemePath()));
|
||||
|
||||
eventPublisher.publishEvent(new ThemeUpdatedEvent(this));
|
||||
|
||||
// Gets theme property again.
|
||||
return getProperty(Paths.get(updatingTheme.getThemePath()));
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in New Issue