mirror of
https://github.com/zen-browser/desktop.git
synced 2026-03-29 11:51:51 +00:00
fix: github folder not getting pr list, p=#12578, c=folders
Co-authored-by: mr. m <mr.m@tuta.com>
This commit is contained in:
@@ -91,9 +91,6 @@ zen-live-folder-github-option-repo =
|
||||
zen-live-folder-github-pull-requests =
|
||||
.label = Pull Requests
|
||||
|
||||
zen-live-folder-github-issues =
|
||||
.label = Issues
|
||||
|
||||
zen-live-folder-github-option-repo-list-note =
|
||||
.label = This list is generated based on your currently active pull requests.
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
data-l10n-id="zen-live-folder-github-pull-requests"
|
||||
command="cmd_zenNewLiveFolder"
|
||||
image="chrome://browser/skin/zen-icons/selectable/logo-github.svg" />
|
||||
<menuitem
|
||||
data-l10n-id="zen-live-folder-github-issues"
|
||||
command="cmd_zenNewLiveFolder"
|
||||
image="chrome://browser/skin/zen-icons/selectable/logo-github.svg" />
|
||||
<menuitem
|
||||
data-l10n-id="zen-live-folder-type-rss"
|
||||
command="cmd_zenNewLiveFolder"
|
||||
|
||||
@@ -123,8 +123,6 @@ export class nsZenLiveFolderProvider {
|
||||
|
||||
fetch(url, { maxContentLength = 5 * 1024 * 1024 } = {}) {
|
||||
const uri = lazy.NetUtil.newURI(url);
|
||||
// TODO: Support userContextId when fetching, it should be inherited from the folder's
|
||||
// current space context ID.
|
||||
let userContextId = 0;
|
||||
let folder = this.manager.getFolderForLiveFolder(this);
|
||||
if (folder) {
|
||||
|
||||
@@ -98,10 +98,6 @@ class nsZenLiveFoldersManager {
|
||||
this.createFolder("github:pull-requests");
|
||||
break;
|
||||
}
|
||||
case "zen-live-folder-github-issues": {
|
||||
this.createFolder("github:issues");
|
||||
break;
|
||||
}
|
||||
case "zen-live-folder-type-rss": {
|
||||
this.createFolder("rss");
|
||||
break;
|
||||
|
||||
@@ -10,9 +10,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
constructor({ id, state, manager }) {
|
||||
super({ id, state, manager });
|
||||
|
||||
this.state.url = "https://github.com/issues/assigned";
|
||||
this.state.type = state.type;
|
||||
|
||||
this.state.url = "https://github.com/pulls/assigned";
|
||||
this.state.options = state.options ?? {};
|
||||
this.state.repos = new Set(state.repos ?? []);
|
||||
this.state.options.repoExcludes = new Set(state.options.repoExcludes ?? []);
|
||||
@@ -40,37 +38,34 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
}
|
||||
|
||||
const document = new DOMParser().parseFromString(text, "text/html");
|
||||
const issues = document.querySelectorAll(
|
||||
"div[class^=IssueItem-module__defaultRepoContainer]"
|
||||
);
|
||||
const pull_requests = document.querySelectorAll("div[class^=Description-module__container]");
|
||||
const items = [];
|
||||
const activeRepos = new Set();
|
||||
|
||||
if (issues.length) {
|
||||
const authors = document.querySelectorAll("a[class^=IssueItem-module__authorCreatedLink]");
|
||||
if (pull_requests.length) {
|
||||
const authors = document.querySelectorAll(
|
||||
"div[class^=MainContent-module__inner] [data-testid='timestamp-container'] span:nth-child(2)"
|
||||
);
|
||||
const titles = document.querySelectorAll("div[class^=Title-module__container]");
|
||||
const links = document.querySelectorAll('[data-testid="issue-pr-title-link"]');
|
||||
const links = document.querySelectorAll("a[class^=Title-module__anchor]");
|
||||
|
||||
for (let i = 0; i < issues.length; i++) {
|
||||
const [rawRepo, rawNumber] = issues[i].childNodes;
|
||||
const author = authors[i]?.textContent;
|
||||
for (let i = 0; i < pull_requests.length; i++) {
|
||||
const repo = pull_requests[i].childNodes[0].textContent;
|
||||
const prNum = pull_requests[i].childNodes[4].textContent;
|
||||
const author = authors[i]?.firstChild?.textContent;
|
||||
const title = titles[i]?.textContent;
|
||||
const issueUrl = links[i]?.href;
|
||||
const prUrl = links[i]?.href;
|
||||
|
||||
const repo = rawRepo.textContent?.trim();
|
||||
if (repo) {
|
||||
activeRepos.add(repo);
|
||||
}
|
||||
|
||||
const numberMatch = rawNumber?.textContent?.match(/[0-9]+/);
|
||||
const number = numberMatch?.[0] ?? "";
|
||||
|
||||
items.push({
|
||||
title,
|
||||
subtitle: author,
|
||||
icon: "chrome://browser/content/zen-images/favicons/github.svg",
|
||||
url: "https://github.com" + issueUrl,
|
||||
id: `${repo}#${number}`,
|
||||
url: new URL(prUrl, this.state.url).href,
|
||||
id: `${repo}#${prNum}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -88,7 +83,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
let searchParams = new URLSearchParams();
|
||||
const options = [
|
||||
{
|
||||
value: "state:open",
|
||||
value: "is:open",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
@@ -98,11 +93,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
[
|
||||
{
|
||||
value: "is:pr",
|
||||
enabled: this.state.type === "pull-requests",
|
||||
},
|
||||
{
|
||||
value: "is:issue",
|
||||
enabled: this.state.type === "issues",
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -186,7 +177,6 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
l10nId: "zen-live-folder-github-option-review-requested",
|
||||
key: "reviewRequested",
|
||||
checked: this.state.options.reviewRequested ?? false,
|
||||
hidden: this.state.type === "issues",
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user