mirror of https://github.com/halo-dev/halo
fix: incorrect results when filtering unpublished posts (#4736)
#### What type of PR is this? /kind bug /area core /milestone 2.10.x #### What this PR does / why we need it: 修复筛选未发布文章时结果不正确的问题 #### Which issue(s) this PR fixes: Fixes #4730 #### Does this PR introduce a user-facing change? ```release-note 修复筛选未发布文章时结果不正确的问题 ```pull/4772/head
parent
772c7fcf97
commit
baca058bb3
|
@ -13,6 +13,7 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
@ -102,6 +103,10 @@ public class PostReconciler implements Reconciler<Reconciler.Request> {
|
||||||
post.getMetadata().setAnnotations(annotations);
|
post.getMetadata().setAnnotations(annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!annotations.containsKey(Post.PUBLISHED_LABEL)) {
|
||||||
|
labels.put(Post.PUBLISHED_LABEL, BooleanUtils.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
var status = post.getStatus();
|
var status = post.getStatus();
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
status = new Post.PostStatus();
|
status = new Post.PostStatus();
|
||||||
|
|
Loading…
Reference in New Issue