Skip to content

Commit 0ba4476

Browse files
committed
Add new discussions url to isDiscussion()
Solved: #175
1 parent 9ef3a37 commit 0ba4476

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,12 @@ addTests('isProjects', [
207207
'https://github.com/sindresorhus/refined-github/projects',
208208
]);
209209

210-
export const isDiscussion = (url: URL | HTMLAnchorElement | Location = location): boolean => /^discussions\/\d+/.test(getRepo(url)?.path ?? getOrg(url)?.path!);
210+
export const isDiscussion = (url: URL | HTMLAnchorElement | Location = location): boolean => (/^discussions\/\d+/.test(getRepo(url)?.path ?? getOrg(url)?.path!)) || getRepo(url)?.path === 'discussions/new';
211211
addTests('isDiscussion', [
212212
'https://github.com/tophf/mpiv/discussions/50',
213213
'https://github.com/orgs/community/discussions/11202',
214+
'https://github.com/withastro/roadmap/discussions/new',
215+
'https://github.com/withastro/roadmap/discussions/new?category=proposal',
214216
]);
215217

216218
export const isDiscussionList = (url: URL | HTMLAnchorElement | Location = location): boolean => getRepo(url)?.path === 'discussions' || getOrg(url)?.path === 'discussions';

0 commit comments

Comments
 (0)