@@ -183,19 +183,28 @@ TEST: addTests('isGist', [
183183 'https://gist.my-little-hub.com/in-fragrante' ,
184184] ) ;
185185
186- export const isGlobalIssueOrPRList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => [ ' issues' , 'pulls' ] . includes ( url . pathname . split ( '/' , 2 ) [ 1 ] ! ) ;
187- TEST: addTests ( 'isGlobalIssueOrPRList ' , [
186+ export const isGlobalIssueList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => / ^ i s s u e s ( $ | \/ ) / . test ( getCleanPathname ( url ) ) ;
187+ TEST: addTests ( 'isGlobalIssueList ' , [
188188 'https://github.com/issues' ,
189- 'https://github.com/issues?q=is%3Apr+is%3Aopen' ,
190189 'https://github.com/issues/assigned' ,
191190 'https://github.com/issues/mentioned' ,
191+ 'https://github.com/issues?q=is%3Apr+is%3Aopen' ,
192+ 'https://github.com//issues/' ,
193+ ] ) ;
194+
195+ export const isGlobalPRList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => / ^ p u l l s ( $ | \/ ) / . test ( getCleanPathname ( url ) ) ;
196+ TEST: addTests ( 'isGlobalPRList' , [
192197 'https://github.com/pulls' ,
193- 'https://github.com/pulls?q=issues' ,
194198 'https://github.com/pulls/assigned' ,
195199 'https://github.com/pulls/mentioned' ,
196200 'https://github.com/pulls/review-requested' ,
201+ 'https://github.com/pulls?q=issues' ,
202+ 'https://github.com//pulls/' ,
197203] ) ;
198204
205+ export const isGlobalIssueOrPRList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => isGlobalPRList ( url ) || isGlobalIssueList ( url ) ;
206+ TEST: addTests ( 'isGlobalIssueOrPRList' , combinedTestOnly ) ;
207+
199208export const isGlobalSearchResults = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => url . pathname === '/search' && new URLSearchParams ( url . search ) . get ( 'q' ) !== null ;
200209TEST: addTests ( 'isGlobalSearchResults' , [
201210 'https://github.com/search?q=refined-github&ref=opensearch' ,
@@ -318,15 +327,8 @@ TEST: addTests('isPRConflicts', [
318327] ) ;
319328
320329/** 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 */
321- export const isPRList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => url . pathname === '/pulls' || getRepo ( url ) ?. path === 'pulls' ;
322- TEST: addTests ( 'isPRList' , [
323- 'https://github.com/pulls' ,
324- 'https://github.com/pulls?q=issues' ,
325- 'https://github.com/sindresorhus/refined-github/pulls' ,
326- 'https://github.com/sindresorhus/refined-github/pulls/' ,
327- 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr' ,
328- 'https://github.com/sindresorhus/refined-github/pulls?q=is%3Apr+is%3Aclosed' ,
329- ] ) ;
330+ export const isPRList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => isRepoPRList ( url ) || isGlobalPRList ( url ) ;
331+ TEST: addTests ( 'isPRList' , combinedTestOnly ) ;
330332
331333export const isPRCommit = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => / ^ p u l l \/ \d + \/ ( c o m m i t s | c h a n g e s ) \/ [ \d a - f ] { 7 , 40 } $ / . test ( getRepo ( url ) ?. path ) ;
332334TEST: addTests ( 'isPRCommit' , [
@@ -458,7 +460,7 @@ TEST: addTests('isRepo', [
458460 // Some of these are here simply as "gotchas" to other detections
459461 'https://github.com/sindresorhus/refined-github/blame/master/package.json' ,
460462 'https://github.com/sindresorhus/refined-github/issues/146' ,
461- 'https://github.com/sindresorhus/notifications/' ,
463+ 'https://github.com/sindresorhus/notifications/' , // Gotcha for isNotifications
462464 'https://github.com/sindresorhus/refined-github/pull/148' ,
463465 'https://github.com/sindresorhus/refined-github/milestones/new' , // Gotcha for isRepoTaxonomyIssueOrPRList
464466 'https://github.com/sindresorhus/refined-github/milestones/1/edit' , // Gotcha for isRepoTaxonomyIssueOrPRList
@@ -538,6 +540,8 @@ TEST: addTests('isRepoHome', [
538540 'https://github.com/sindresorhus/search' ,
539541 'https://github.com/sindresorhus/branches' ,
540542 'https://github.com/sindresorhus/refined-github?files=1' ,
543+ 'https://github.com/pullsuser/my-library' , // Gotcha for isRepoPRList
544+ 'https://github.com/issuesuser/my-library' , // Gotcha for isRepoIssueList
541545] ) ;
542546
543547export type RepoExplorerInfo = {
@@ -791,6 +795,8 @@ TEST: addTests('isProfile', [
791795 'https://github.com/sindresorhus?tab=followers' ,
792796 'https://github.com/fregante?tab=following' ,
793797 'https://github.com/sindresorhus?tab=following' ,
798+ 'https://github.com/pullsuser' , // Gotcha for isGlobalPRList
799+ 'https://github.com/issuesuser' , // Gotcha for isGlobalIssueList
794800] ) ;
795801
796802export const isGistProfile = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => doesLookLikeAProfile ( getCleanGistPathname ( url ) ) ;
0 commit comments