Skip to content

fix(post): exclude recycled posts from halo post list by default#7

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/filter-out-recycled-articles
Draft

fix(post): exclude recycled posts from halo post list by default#7
Copilot wants to merge 3 commits intomainfrom
copilot/filter-out-recycled-articles

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

halo post list was returning all posts including those in the recycle bin (spec.deleted=true), polluting the output with trash content.

Changes

  • src/commands/post/index.ts: Pass fieldSelector: ["spec.deleted=false"] to listPosts by default so recycled posts are excluded at the API level. Added --all option that, when specified, omits the field selector so all posts including recycled ones are returned.
  • src/commands/post/__test__/post-entry.spec.ts: Update list command test assertion to expect the new fieldSelector, and add a new test verifying --all omits the filter.
const response = await clients.console.content.post.listPosts({
  page: parseNumberOption(options.page),
  size: parseNumberOption(options.size),
  keyword: options.keyword,
  publishPhase: options.publishPhase as never,
  categoryWithChildren: options.category,
  fieldSelector: options.all ? undefined : ["spec.deleted=false"],
});

Usage:

# List posts, excluding recycled (default)
halo post list

# List all posts including recycled
halo post list --all
Original prompt

This section details on the original issue you should resolve

<issue_title>建议过滤掉回收站的文章</issue_title>
<issue_description>当前通过 halo post list 会查询出所有文章,包括回收站的,建议过滤掉。

/kind improvement

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Mar 19, 2026

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
Copilot AI changed the title [WIP] Filter out articles from the recycle bin in post list fix(post): exclude recycled posts from halo post list Mar 19, 2026
Copilot AI requested a review from ruibaby March 19, 2026 08:58
@LIlGG
Copy link
Member

LIlGG commented Mar 19, 2026

@copilot 能否增加一个 option,当我在命令中输入此 option 时,显示出所有的文章,包括回收站内的。
如果不输入此 option 时,则不显示回收站内的。

@ruibaby
Copy link
Member

ruibaby commented Mar 19, 2026

@copilot 能否增加一个 option,当我在命令中输入此 option 时,显示出所有的文章,包括回收站内的。 如果不输入此 option 时,则不显示回收站内的。

@copilot

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot 能否增加一个 option,当我在命令中输入此 option 时,显示出所有的文章,包括回收站内的。 如果不输入此 option 时,则不显示回收...

Done in commit 40017e3. Added --all flag to halo post list:

  • Default (halo post list): recycled posts are excluded (spec.deleted=false field selector applied)
  • With flag (halo post list --all): all posts including recycled ones are returned

Copilot AI changed the title fix(post): exclude recycled posts from halo post list fix(post): exclude recycled posts from halo post list by default Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

建议过滤掉回收站的文章

3 participants