mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-19 05:01:33 +00:00
gh-14847: Add draft filtering to GitHub Live Folders (gh-14839)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user