Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ TEST: addTests('isRepositoryActions', [

export const isUserTheOrganizationOwner = (): boolean => isOrganizationProfile() && exists('[aria-label="Organization"] [data-tab-item="org-header-settings-tab"]');

/**
* @deprecated Use canUserAccessRepoSettings or API instead.
*/
export const canUserAdminRepo = (): boolean => {
const repo = getRepo();
return Boolean(repo && exists(`:is(${[
Expand All @@ -874,6 +877,9 @@ export const canUserAdminRepo = (): boolean => {
].join(',')}) a[href="/${repo.nameWithOwner}/settings"]`));
};

// eslint-disable-next-line @typescript-eslint/no-deprecated
export const canUserAccessRepoSettings = canUserAdminRepo;

export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && (url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
TEST: addTests('isNewRepo', [
'https://github.com/new',
Expand Down