Skip to content

Commit 8379603

Browse files
Deprecate canUserAdminRepo; add doesUserHaveRepoWriteAccess
1 parent 6da6dd6 commit 8379603

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,9 @@ TEST: addTests('isRepositoryActions', [
865865

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

868+
/**
869+
* @deprecated Use doesUserHaveRepoWriteAccess or API instead.
870+
*/
868871
export const canUserAdminRepo = (): boolean => {
869872
const repo = getRepo();
870873
return Boolean(repo && exists(`:is(${[
@@ -874,6 +877,9 @@ export const canUserAdminRepo = (): boolean => {
874877
].join(',')}) a[href="/${repo.nameWithOwner}/settings"]`));
875878
};
876879

880+
// eslint-disable-next-line @typescript-eslint/no-deprecated
881+
export const doesUserHaveRepoWriteAccess = canUserAdminRepo;
882+
877883
export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && (url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
878884
TEST: addTests('isNewRepo', [
879885
'https://github.com/new',

0 commit comments

Comments
 (0)