From f9a97ac4360912640e613aa340af7d7a3f6450c0 Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 14 Apr 2026 20:37:09 +0500 Subject: [PATCH 1/8] isPRList - Support global PR list subpaths --- index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 8f24f21..ab88aa3 100644 --- a/index.ts +++ b/index.ts @@ -318,10 +318,11 @@ TEST: addTests('isPRConflicts', [ ]); /** Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */ -export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/pulls' || getRepo(url)?.path === 'pulls'; +export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname.startsWith('/pulls') || isRepoPRList(url); TEST: addTests('isPRList', [ 'https://github.com/pulls', 'https://github.com/pulls?q=issues', + 'https://github.com/pulls/review-requested', 'https://github.com/sindresorhus/refined-github/pulls', 'https://github.com/sindresorhus/refined-github/pulls/', 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr', From 4255861750d55441905a9bb1a198c8ef481350c7 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:19:15 +0500 Subject: [PATCH 2/8] changes --- index.ts | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/index.ts b/index.ts index ab88aa3..73ef330 100644 --- a/index.ts +++ b/index.ts @@ -183,19 +183,28 @@ TEST: addTests('isGist', [ 'https://gist.my-little-hub.com/in-fragrante', ]); -export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => ['issues', 'pulls'].includes(url.pathname.split('/', 2)[1]!); -TEST: addTests('isGlobalIssueOrPRList', [ +export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'issues'; +TEST: addTests('isGlobalPRList', [ 'https://github.com/issues', - 'https://github.com/issues?q=is%3Apr+is%3Aopen', 'https://github.com/issues/assigned', 'https://github.com/issues/mentioned', + 'https://github.com/issues?q=is%3Apr+is%3Aopen', + 'https://github.com//issues/', +]); + +export const isGlobalPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'pulls'; +TEST: addTests('isGlobalPRList', [ 'https://github.com/pulls', - 'https://github.com/pulls?q=issues', 'https://github.com/pulls/assigned', 'https://github.com/pulls/mentioned', 'https://github.com/pulls/review-requested', + 'https://github.com/pulls?q=issues', + 'https://github.com//pulls/', ]); +export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalIssueList(url) || isGlobalPRList(url); +TEST: addTests('isGlobalIssueOrPRList', combinedTestOnly); + export const isGlobalSearchResults = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/search' && new URLSearchParams(url.search).get('q') !== null; TEST: addTests('isGlobalSearchResults', [ 'https://github.com/search?q=refined-github&ref=opensearch', @@ -318,16 +327,8 @@ TEST: addTests('isPRConflicts', [ ]); /** Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */ -export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname.startsWith('/pulls') || isRepoPRList(url); -TEST: addTests('isPRList', [ - 'https://github.com/pulls', - 'https://github.com/pulls?q=issues', - 'https://github.com/pulls/review-requested', - 'https://github.com/sindresorhus/refined-github/pulls', - 'https://github.com/sindresorhus/refined-github/pulls/', - 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr', - 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Apr+is%3Aclosed', -]); +export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalPRList(url) || isRepoPRList(url); +TEST: addTests('isPRList', combinedTestOnly); export const isPRCommit = (url: URL | HTMLAnchorElement | Location = location): boolean => /^pull\/\d+\/(commits|changes)\/[\da-f]{7,40}$/.test(getRepo(url)?.path); TEST: addTests('isPRCommit', [ @@ -459,7 +460,7 @@ TEST: addTests('isRepo', [ // Some of these are here simply as "gotchas" to other detections 'https://github.com/sindresorhus/refined-github/blame/master/package.json', 'https://github.com/sindresorhus/refined-github/issues/146', - 'https://github.com/sindresorhus/notifications/', + 'https://github.com/sindresorhus/notifications/', // Gotcha for isNotifications 'https://github.com/sindresorhus/refined-github/pull/148', 'https://github.com/sindresorhus/refined-github/milestones/new', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList @@ -792,6 +793,8 @@ TEST: addTests('isProfile', [ 'https://github.com/sindresorhus?tab=followers', 'https://github.com/fregante?tab=following', 'https://github.com/sindresorhus?tab=following', + 'https://github.com/pullsuser', // Gotcha for isGlobalPRList + 'https://github.com/issuesuser', // Gotcha for isGlobalIssueList ]); export const isGistProfile = (url: URL | HTMLAnchorElement | Location = location): boolean => doesLookLikeAProfile(getCleanGistPathname(url)); From 928344defcab0cb3a279951b13e51278624183f5 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:25:04 +0500 Subject: [PATCH 3/8] oops --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 73ef330..bab91bb 100644 --- a/index.ts +++ b/index.ts @@ -184,7 +184,7 @@ TEST: addTests('isGist', [ ]); export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'issues'; -TEST: addTests('isGlobalPRList', [ +TEST: addTests('isGlobalIssueList', [ 'https://github.com/issues', 'https://github.com/issues/assigned', 'https://github.com/issues/mentioned', From 6d97ff16fc07bebc7ddf23fe46f702b5978835cb Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:39:42 +0500 Subject: [PATCH 4/8] =?UTF-8?q?fix=20`isGlobalIssueList`=20&=20`isGlobalPR?= =?UTF-8?q?List`=20=F0=9F=A4=A6=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index bab91bb..4d57d08 100644 --- a/index.ts +++ b/index.ts @@ -183,7 +183,7 @@ TEST: addTests('isGist', [ 'https://gist.my-little-hub.com/in-fragrante', ]); -export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'issues'; +export const isGlobalIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^issues($|\/)/.test(getCleanPathname(url)); TEST: addTests('isGlobalIssueList', [ 'https://github.com/issues', 'https://github.com/issues/assigned', @@ -192,7 +192,7 @@ TEST: addTests('isGlobalIssueList', [ 'https://github.com//issues/', ]); -export const isGlobalPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => getCleanPathname(url) === 'pulls'; +export const isGlobalPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^pulls($|\/)/.test(getCleanPathname(url)); TEST: addTests('isGlobalPRList', [ 'https://github.com/pulls', 'https://github.com/pulls/assigned', From f0e50cfa18bfb7bc8cf377fff82a3e3e9e5adca1 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:41:46 +0500 Subject: [PATCH 5/8] add gotchas for `isRepoPRList` & `isRepoIssueList` --- index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.ts b/index.ts index 4d57d08..dd25528 100644 --- a/index.ts +++ b/index.ts @@ -466,6 +466,8 @@ TEST: addTests('isRepo', [ 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList 'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList + 'https://github.com//pullsuser/my-library', // Gotcha for isRepoPRList + 'https://github.com//issuesuser/my-library', // Gotcha for isRepoIssueList ]); export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); From c2e674d4e1af07d3c3ab050afb4ec9b63e9fef2f Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:45:42 +0500 Subject: [PATCH 6/8] hopefully fix tests --- index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index dd25528..7773b30 100644 --- a/index.ts +++ b/index.ts @@ -466,8 +466,8 @@ TEST: addTests('isRepo', [ 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList 'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList - 'https://github.com//pullsuser/my-library', // Gotcha for isRepoPRList - 'https://github.com//issuesuser/my-library', // Gotcha for isRepoIssueList + 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList + 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList ]); export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url); @@ -542,6 +542,8 @@ TEST: addTests('isRepoHome', [ 'https://github.com/sindresorhus/search', 'https://github.com/sindresorhus/branches', 'https://github.com/sindresorhus/refined-github?files=1', + 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList + 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList ]); export type RepoExplorerInfo = { From c9abc93c835ca2b33673678cab48a13484aec9d1 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 05:59:27 +0500 Subject: [PATCH 7/8] reorder checks --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 7773b30..23d7f05 100644 --- a/index.ts +++ b/index.ts @@ -202,7 +202,7 @@ TEST: addTests('isGlobalPRList', [ 'https://github.com//pulls/', ]); -export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalIssueList(url) || isGlobalPRList(url); +export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalPRList(url) || isGlobalIssueList(url); TEST: addTests('isGlobalIssueOrPRList', combinedTestOnly); export const isGlobalSearchResults = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/search' && new URLSearchParams(url.search).get('q') !== null; @@ -327,7 +327,7 @@ TEST: addTests('isPRConflicts', [ ]); /** Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */ -export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isGlobalPRList(url) || isRepoPRList(url); +export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepoPRList(url) || isGlobalPRList(url); TEST: addTests('isPRList', combinedTestOnly); export const isPRCommit = (url: URL | HTMLAnchorElement | Location = location): boolean => /^pull\/\d+\/(commits|changes)\/[\da-f]{7,40}$/.test(getRepo(url)?.path); From 554e7fa6a3b7ac235c41cbec5ad6c6a007190e13 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 20:20:37 +0500 Subject: [PATCH 8/8] remove gotchas from isRepo --- index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.ts b/index.ts index 23d7f05..81239f1 100644 --- a/index.ts +++ b/index.ts @@ -466,8 +466,6 @@ TEST: addTests('isRepo', [ 'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList 'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList 'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList - 'https://github.com/pullsuser/my-library', // Gotcha for isRepoPRList - 'https://github.com/issuesuser/my-library', // Gotcha for isRepoIssueList ]); export const hasRepoHeader = (url: URL | HTMLAnchorElement | Location = location): boolean => isRepo(url) && !isRepoSearch(url);