gh-14847: Add draft filtering to GitHub Live Folders (gh-14839)

This commit is contained in:
dpkass
2026-08-05 02:52:14 +02:00
committed by GitHub
parent 871bdde4cc
commit 77aa6ff6c9
3 changed files with 25 additions and 0 deletions

View File

@@ -20,6 +20,9 @@ zen-live-folder-github-option-assigned-self =
zen-live-folder-github-option-review-requested =
.label = Review Requests
zen-live-folder-github-option-include-drafts =
.label = Include Draft Pull Requests
zen-live-folder-type-rss =
.label = RSS Feed

View File

@@ -253,6 +253,13 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
"sort:updated-desc",
];
if (
this.state.type === "pull-requests" &&
!(this.state.options.includeDrafts ?? true)
) {
baseQuery.push("draft:false");
}
const options = [
{
value: "author:@me",
@@ -336,6 +343,12 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
checked: this.state.options.reviewRequested ?? false,
hidden: this.state.type === "issues",
},
{
l10nId: "zen-live-folder-github-option-include-drafts",
key: "includeDrafts",
checked: this.state.options.includeDrafts ?? true,
hidden: this.state.type !== "pull-requests",
},
{ type: "separator" },
{
l10nId: "zen-live-folder-github-option-repo-filter",

View File

@@ -76,6 +76,10 @@ add_task(async function test_fetch_items_url_construction() {
!query.includes("review-requested:@me"),
"Should NOT include review-requested"
);
Assert.ok(
!query.includes("draft:false"),
"Should include draft pull requests by default"
);
sandbox.restore();
});
@@ -88,6 +92,7 @@ add_task(async function test_fetch_items_url_complex_options() {
let instance = getGithubProviderForTest(sandbox, {
authorMe: true,
assignedMe: true,
includeDrafts: false,
reviewRequested: true,
});
@@ -107,6 +112,10 @@ add_task(async function test_fetch_items_url_complex_options() {
query.includes("review-requested:@me"),
"Should include review-requested"
);
Assert.ok(
query.includes("draft:false"),
"Should exclude draft pull requests"
);
Assert.ok(query.includes(" OR "), "Should contain OR operators");
sandbox.restore();