Skip to content

Commit

Permalink
fix: incorrect results when filtering unpublished posts (#4736)
Browse files Browse the repository at this point in the history
#### 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
修复筛选未发布文章时结果不正确的问题
```
  • Loading branch information
guqing authored Oct 23, 2023
1 parent 772c7fc commit baca058
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Optional;
import java.util.Set;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.springframework.context.ApplicationEvent;
Expand Down Expand Up @@ -102,6 +103,10 @@ public Result reconcile(Request request) {
post.getMetadata().setAnnotations(annotations);
}

if (!annotations.containsKey(Post.PUBLISHED_LABEL)) {
labels.put(Post.PUBLISHED_LABEL, BooleanUtils.FALSE);
}

var status = post.getStatus();
if (status == null) {
status = new Post.PostStatus();
Expand Down

0 comments on commit baca058

Please sign in to comment.