Skip to content

Commit 6da6dd6

Browse files
canUserAdminRepo - Support new UI (#240)
Co-authored-by: Grigory <techuila.sunset@gmail.com>
1 parent 3b164a8 commit 6da6dd6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,14 @@ TEST: addTests('isRepositoryActions', [
865865

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

868-
export const canUserAdminRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"], [data-tab-item$="settings-tab"]');
868+
export const canUserAdminRepo = (): boolean => {
869+
const repo = getRepo();
870+
return Boolean(repo && exists(`:is(${[
871+
'.GlobalNav',
872+
// Remove after June 2026
873+
'.js-repo-nav',
874+
].join(',')}) a[href="/${repo.nameWithOwner}/settings"]`));
875+
};
869876

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

0 commit comments

Comments
 (0)