Skip to content

Commit cb1521a

Browse files
Include /user/repo/labels/<label> in isRepoIssueList (#75)
Co-authored-by: Federico Brigante <me@fregante.com>
1 parent a18db82 commit cb1521a

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ const exists = (selector: string) => Boolean(document.querySelector(selector));
55

66
const combinedTestOnly = 'combinedTestOnly'; // To be used only to skip tests of combined functions, i.e. isPageA() || isPageB()
77

8+
collect.set('__urls_that_dont_match__', [
9+
'https://github.com/sindresorhus/refined-github/issues/new',
10+
'https://github.com/sindresorhus/refined-github/issues/new/choose',
11+
'https://github.com/sindresorhus/refined-github/issues/templates/edit',
12+
]);
13+
814
export const is404 = (): boolean => document.title === 'Page not found · GitHub';
915

1016
export const is500 = (): boolean => document.title === 'Server Error · GitHub' || document.title === 'Unicorn! · GitHub' || document.title === '504 Gateway Time-out';
@@ -115,6 +121,7 @@ collect.set('isConversation', combinedTestOnly);
115121
export const isLabelList = (url: URL | HTMLAnchorElement | Location = location): boolean => getRepo(url)?.path === 'labels';
116122
collect.set('isLabelList', [
117123
'https://github.com/sindresorhus/refined-github/labels',
124+
'https://github.com/sindresorhus/refined-github/labels/',
118125
]);
119126

120127
export const isMilestone = (url: URL | HTMLAnchorElement | Location = location): boolean => /^milestone\/\d+/.test(getRepo(url)?.path!);
@@ -283,7 +290,9 @@ export const isEmptyRepo = (): boolean => exists('[aria-label="Cannot fork becau
283290

284291
export const isRepoTaxonomyConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepo(url)?.path!);
285292
collect.set('isRepoTaxonomyConversationList', [
286-
'https://github.com/sindresorhus/refined-github/labels/Priority%3A%20critical',
293+
'https://github.com/sindresorhus/refined-github/labels/bug',
294+
'https://github.com/sindresorhus/refined-github/labels/implemented%20by%20github',
295+
'https://github.com/sindresorhus/refined-github/labels/%3Adollar%3A%20Funded%20on%20Issuehunt',
287296
'https://github.com/sindresorhus/refined-github/milestones/1',
288297
]);
289298

@@ -301,17 +310,19 @@ collect.set('isRepoPRList', [
301310
'https://github.com/sindresorhus/refined-github/pulls?q=is%3Apr+is%3Aclosed',
302311
]);
303312

304-
// `issues/fregante` is a list but `issues/1`, `issues/new`, `issues/new/choose`, `issues/templates/edit` aren’t
305313
export const isRepoIssueList = (url: URL | HTMLAnchorElement | Location = location): boolean =>
306-
Boolean(getRepo(url)?.path.startsWith('issues')) &&
307-
!/^issues\/(\d+|new|templates)($|\/)/.test(getRepo(url)?.path!);
314+
// `issues/fregante` is a list but `issues/1`, `issues/new`, `issues/new/choose`, `issues/templates/edit` aren’t
315+
/^labels\/|^issues(?!\/(\d+|new|templates)($|\/))/.test(getRepo(url)?.path!);
308316
collect.set('isRepoIssueList', [
309317
'http://github.com/sindresorhus/ava/issues',
310318
'https://github.com/sindresorhus/refined-github/issues',
311319
'https://github.com/sindresorhus/refined-github/issues/fregante',
312320
'https://github.com/sindresorhus/refined-github/issues/newton',
313321
'https://github.com/sindresorhus/refined-github/issues/wptemplates',
314322
'https://github.com/sindresorhus/refined-github/issues?q=is%3Aclosed+sort%3Aupdated-desc',
323+
'https://github.com/sindresorhus/refined-github/labels/bug',
324+
'https://github.com/sindresorhus/refined-github/labels/implemented%20by%20github',
325+
'https://github.com/sindresorhus/refined-github/labels/%3Adollar%3A%20Funded%20on%20Issuehunt',
315326
]);
316327

317328
export const isRepoHome = (url: URL | HTMLAnchorElement | Location = location): boolean => getRepo(url)?.path === '';

0 commit comments

Comments
 (0)