Skip to content

Commit 2d1f30e

Browse files
authored
Replace "Conversation" with "IssueOrPR" for clarity (#139)
1 parent b456414 commit 2d1f30e

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ addTests('isGist', [
9999
'https://gist.github.com/kidonng/0d16c7f17045f486751fad1b602204a0/revisions',
100100
]);
101101

102-
export const isGlobalConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean => ['issues', 'pulls'].includes(url.pathname.split('/', 2)[1]!);
103-
addTests('isGlobalConversationList', [
102+
export const isGlobalIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => ['issues', 'pulls'].includes(url.pathname.split('/', 2)[1]!);
103+
addTests('isGlobalIssueOrPRList', [
104104
'https://github.com/issues',
105105
'https://github.com/issues?q=is%3Apr+is%3Aopen',
106106
'https://github.com/issues/assigned',
@@ -122,11 +122,11 @@ addTests('isIssue', [
122122
'https://github.com/sindresorhus/refined-github/issues/146',
123123
]);
124124

125-
export const isConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean =>
126-
isGlobalConversationList(url)
127-
|| isRepoConversationList(url)
125+
export const isIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean =>
126+
isGlobalIssueOrPRList(url)
127+
|| isRepoIssueOrPRList(url)
128128
|| isMilestone(url);
129-
addTests('isConversationList', combinedTestOnly);
129+
addTests('isIssueOrPRList', combinedTestOnly);
130130

131131
export const isConversation = (url: URL | HTMLAnchorElement | Location = location): boolean => isIssue(url) || isPRConversation(url);
132132
addTests('isConversation', combinedTestOnly);
@@ -222,7 +222,7 @@ addTests('isPRConflicts', [
222222
'https://github.com/sindresorhus/refined-github/pull/148/conflicts',
223223
]);
224224

225-
/** Any `isConversationList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */
225+
/** 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 */
226226
export const isPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/pulls' || getRepo(url)?.path === 'pulls';
227227
addTests('isPRList', [
228228
'https://github.com/pulls',
@@ -339,8 +339,8 @@ addTests('isRepo', [
339339
'https://github.com/sindresorhus/refined-github/issues/146',
340340
'https://github.com/sindresorhus/notifications/',
341341
'https://github.com/sindresorhus/refined-github/pull/148',
342-
'https://github.com/sindresorhus/refined-github/milestones/new', // Gotcha for isRepoTaxonomyConversationList
343-
'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyConversationList
342+
'https://github.com/sindresorhus/refined-github/milestones/new', // Gotcha for isRepoTaxonomyIssueOrPRList
343+
'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList
344344
'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList
345345
'https://github.com/sindresorhus/refined-github/issues/templates/edit', // Gotcha for isRepoIssueList
346346
]);
@@ -354,19 +354,19 @@ export const isArchivedRepo = (): boolean => Boolean(isRepo() && $('#repository-
354354

355355
export const isBlank = (): boolean => exists('main .blankslate');
356356

357-
export const isRepoTaxonomyConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepo(url)?.path!);
358-
addTests('isRepoTaxonomyConversationList', [
357+
export const isRepoTaxonomyIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepo(url)?.path!);
358+
addTests('isRepoTaxonomyIssueOrPRList', [
359359
'https://github.com/sindresorhus/refined-github/labels/bug',
360360
'https://github.com/sindresorhus/refined-github/labels/implemented%20by%20github',
361361
'https://github.com/sindresorhus/refined-github/labels/%3Adollar%3A%20Funded%20on%20Issuehunt',
362362
'https://github.com/sindresorhus/refined-github/milestones/1',
363363
]);
364364

365-
export const isRepoConversationList = (url: URL | HTMLAnchorElement | Location = location): boolean =>
365+
export const isRepoIssueOrPRList = (url: URL | HTMLAnchorElement | Location = location): boolean =>
366366
isRepoPRList(url)
367367
|| isRepoIssueList(url)
368-
|| isRepoTaxonomyConversationList(url);
369-
addTests('isRepoConversationList', combinedTestOnly);
368+
|| isRepoTaxonomyIssueOrPRList(url);
369+
addTests('isRepoIssueOrPRList', combinedTestOnly);
370370

371371
export const isRepoPRList = (url: URL | HTMLAnchorElement | Location = location): boolean => Boolean(getRepo(url)?.path.startsWith('pulls'));
372372
addTests('isRepoPRList', [

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if (pageDetect.isRepo()) { // Uses `window.location.href` by default
3030
alert('You’re looking at a repo!')
3131
}
3232

33-
if (pageDetect.isConversationList()) {
33+
if (pageDetect.isIssueOrPRList()) {
3434
alert('You’re looking at a issues and PRs list!')
3535
}
3636
```
@@ -44,13 +44,13 @@ Most detections are URL-based while others need access to the current `document`
4444
By default, URL-based detections use the `location` global if you don't pass a `url` argument.
4545

4646
```js
47-
if (pageDetect.isConversationList()) {
47+
if (pageDetect.isIssueOrPRList()) {
4848
alert('You’re looking at a issues or PRs list!')
4949
}
5050
```
5151

5252
```js
53-
if (pageDetect.isConversationList(new URL('https://github.com/refined-github/github-url-detection/pulls'))) {
53+
if (pageDetect.isIssueOrPRList(new URL('https://github.com/refined-github/github-url-detection/pulls'))) {
5454
alert('You’re looking at a issues or PRs list!')
5555
}
5656
```

0 commit comments

Comments
 (0)