From 63e8cd0cd53b92c3571981bcb81454f23b8ae34a Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Wed, 6 Apr 2022 16:08:39 +0800 Subject: [PATCH] fix: batch publishing does not refresh private status (#1821) --- .../java/run/halo/app/service/impl/PostServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/run/halo/app/service/impl/PostServiceImpl.java b/src/main/java/run/halo/app/service/impl/PostServiceImpl.java index 2fe35360d..646ec712c 100644 --- a/src/main/java/run/halo/app/service/impl/PostServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/PostServiceImpl.java @@ -206,6 +206,14 @@ public class PostServiceImpl extends BasePostServiceImpl implements PostSe return updatedPost; } + @Override + @Transactional(rollbackFor = Exception.class) + public Post updateStatus(PostStatus status, Integer postId) { + Post post = super.updateStatus(status, postId); + eventPublisher.publishEvent(new PostUpdatedEvent(this, post)); + return post; + } + @Override public Post getBy(PostStatus status, String slug) { return super.getBy(status, slug);