Skip to content

Commit

Permalink
Add support for new organization repo to isNewRepo (#56)
Browse files Browse the repository at this point in the history
Co-authored-by: Federico <me@fregante.com>
  • Loading branch information
yakov116 and fregante committed Dec 26, 2020
1 parent 8bfb033 commit cf5a3e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,10 @@ export const canUserEditOrganization = (): boolean => isOrganizationProfile() &&

export const canUserEditRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"], [data-tab-item$="settings-tab"]');

export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/new';
export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url));
collect.set('isNewRepo', [
'https://github.com/new',
'https://github.com/organizations/npmhub/repositories/new',
]);

/** Get the logged-in user’s username */
Expand Down

0 comments on commit cf5a3e2

Please sign in to comment.