Skip to content

Commit 2653318

Browse files
committed
Extend DiscussionList detection
to include lists by author: https://github.com/sindresorhus/refined-github/pulls/bfred-it
1 parent b16d8d8 commit 2653318

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

source/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export const isRepo = (): boolean => /^[^/]+\/[^/]+/.test(getCleanPathname()) &&
7777
!isGist() &&
7878
!isRepoSearch();
7979

80-
export const isRepoDiscussionList = (): boolean => /^(issues$|pulls$|labels\/)/.test(getRepoPath()!);
80+
export const isRepoDiscussionList = (): boolean =>
81+
/^(issues|pulls)($|\/$|\/(?!\d+))/.test(getRepoPath()!) || // `issues/bfred-it` is a list but `issues/1` isn't
82+
/^labels\/.+/.test(getRepoPath()!);
8183

8284
export const isRepoRoot = (): boolean => /^(tree[/][^/]+)?$/.test(getRepoPath()!);
8385

test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ test('isIssue', urlMatcherMacro, pageDetect.isIssue, [
153153
test('isRepoDiscussionList', urlMatcherMacro, pageDetect.isRepoDiscussionList, [
154154
'http://github.com/sindresorhus/ava/issues',
155155
'https://github.com/sindresorhus/refined-github/pulls',
156+
'https://github.com/sindresorhus/refined-github/pulls/',
157+
'https://github.com/sindresorhus/refined-github/pulls/bfred-it',
158+
'https://github.com/sindresorhus/refined-github/issues/bfred-it',
156159
'https://github.com/sindresorhus/refined-github/labels/Priority%3A%20critical',
157160
'https://github.com/sindresorhus/refined-github/issues?q=is%3Aclosed+sort%3Aupdated-desc'
158161
], [
@@ -161,7 +164,8 @@ test('isRepoDiscussionList', urlMatcherMacro, pageDetect.isRepoDiscussionList, [
161164
'https://github.com/sindresorhus/refined-github/issues/170',
162165
'https://github.com/sindresorhus/refined-github/pull/148',
163166
'http://github.com/sindresorhus/issues',
164-
'https://github.com/wildlifela/carmichael-lynch-2018/labels'
167+
'https://github.com/sindresorhus/refined-github/labels',
168+
'https://github.com/sindresorhus/refined-github/labels/'
165169
]);
166170

167171
test('isGlobalDiscussionList', urlMatcherMacro, pageDetect.isGlobalDiscussionList, [

0 commit comments

Comments
 (0)