diff --git a/locales/en-US/browser/browser/zen-live-folders.ftl b/locales/en-US/browser/browser/zen-live-folders.ftl index 79988c1dc..92f43e43f 100644 --- a/locales/en-US/browser/browser/zen-live-folders.ftl +++ b/locales/en-US/browser/browser/zen-live-folders.ftl @@ -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 diff --git a/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs b/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs index b30520da0..5b88bce61 100644 --- a/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs +++ b/src/zen/live-folders/providers/GithubLiveFolder.sys.mjs @@ -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", diff --git a/src/zen/tests/live-folders/browser_github_live_folder.js b/src/zen/tests/live-folders/browser_github_live_folder.js index ee1237438..e56be019e 100644 --- a/src/zen/tests/live-folders/browser_github_live_folder.js +++ b/src/zen/tests/live-folders/browser_github_live_folder.js @@ -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();