Skip to content

Commit bc11082

Browse files
authored
Detect "Label" issue list as issue list (refined-github#1232)
1 parent 16c3bc2 commit bc11082

4 files changed

Lines changed: 13 additions & 17 deletions

File tree

source/content.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ function ajaxedPagesHandler() {
244244
enableFeature(addJumpToBottomLink);
245245
}
246246

247-
if (pageDetect.isPRList() || pageDetect.isIssueList()) {
247+
if (pageDetect.isIssueList()) {
248248
enableFeature(addFilterCommentsByYou);
249249
}
250250

251-
if (pageDetect.isPRList() || pageDetect.isIssueList() || pageDetect.isPR() || pageDetect.isIssue()) {
251+
if (pageDetect.isIssueList() || pageDetect.isPR() || pageDetect.isIssue()) {
252252
enableFeature(showRecentlyPushedBranches);
253253
}
254254

source/features/open-all-selected.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-alert */
22
import {h} from 'dom-chef';
33
import select from 'select-dom';
4-
import {isIssueList, isPRList} from '../libs/page-detect';
4+
import {isIssueList} from '../libs/page-detect';
55

66
const confirmationRequiredCount = 10;
77

@@ -25,7 +25,7 @@ function openSelected() {
2525
}
2626

2727
export default function () {
28-
if (!isIssueList() && !isPRList()) {
28+
if (!isIssueList()) {
2929
return;
3030
}
3131

source/libs/page-detect.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const isGist = () => location.hostname.startsWith('gist.') || location.pa
5656

5757
export const isIssue = () => /^issues\/\d+/.test(getRepoPath());
5858

59-
export const isIssueList = () => getRepoPath() === 'issues';
59+
export const isIssueList = () => /^(issues$|pulls$|labels\/)/.test(getRepoPath());
6060

6161
export const isIssueSearch = () => location.pathname.startsWith('/issues');
6262

@@ -82,8 +82,6 @@ export const isPRCommit = () => /^pull\/\d+\/commits\/[0-9a-f]{5,40}/.test(getRe
8282

8383
export const isPRFiles = () => /^pull\/\d+\/files/.test(getRepoPath());
8484

85-
export const isPRList = () => getRepoPath() === 'pulls';
86-
8785
export const isPRSearch = () => location.pathname.startsWith('/pulls');
8886

8987
export const isQuickPR = () => isCompare() && /[?&]quick_pull=1(&|$)/.test(location.search);

test/page-detect.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,17 @@ test('isIssue', urlMatcherMacro, pageDetect.isIssue, [
202202
]);
203203

204204
test('isIssueList', urlMatcherMacro, pageDetect.isIssueList, [
205-
'http://github.com/sindresorhus/ava/issues'
205+
'http://github.com/sindresorhus/ava/issues',
206+
'https://github.com/sindresorhus/refined-github/pulls',
207+
'https://github.com/sindresorhus/refined-github/labels/Priority%3A%20critical',
208+
'https://github.com/sindresorhus/refined-github/issues?q=is%3Aclosed+sort%3Aupdated-desc'
206209
], [
207210
'http://github.com/sindresorhus/ava',
208211
'https://github.com',
209-
'https://github.com/sindresorhus/refined-github/issues/170'
212+
'https://github.com/sindresorhus/refined-github/issues/170',
213+
'https://github.com/sindresorhus/refined-github/pull/148',
214+
'http://github.com/sindresorhus/issues',
215+
'https://github.com/wildlifela/carmichael-lynch-2018/labels'
210216
]);
211217

212218
test('isIssueSearch', urlMatcherMacro, pageDetect.isIssueSearch, [
@@ -289,14 +295,6 @@ test('isPRFiles', urlMatcherMacro, pageDetect.isPRFiles, [
289295
'https://github.com/sindresorhus/refined-github/pulls'
290296
]);
291297

292-
test('isPRList', urlMatcherMacro, pageDetect.isPRList, [
293-
'https://github.com/sindresorhus/refined-github/pulls'
294-
], [
295-
'http://github.com/sindresorhus/ava',
296-
'https://github.com',
297-
'https://github.com/sindresorhus/refined-github/pull/148'
298-
]);
299-
300298
test('isPRSearch', urlMatcherMacro, pageDetect.isPRSearch, [
301299
'https://github.com/pulls'
302300
], [

0 commit comments

Comments
 (0)