Skip to content

Commit 3647a3d

Browse files
account for repos with "settings" name
1 parent 6da483a commit 3647a3d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

index.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,15 @@ 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([
869-
'.GlobalNav a[href$="/settings"]',
870-
// Remove after June 2026
871-
'.reponav-item[href$="/settings"]',
872-
'[data-tab-item$="settings-tab"]',
873-
].join(','));
868+
export const canUserAdminRepo = (): boolean => {
869+
const repo = getRepo();
870+
return Boolean(repo && exists([
871+
`.GlobalNav a[href="${repo.nameWithOwner}/settings"]`,
872+
// Remove after June 2026
873+
'.reponav-item[href$="/settings"]',
874+
'[data-tab-item$="settings-tab"]',
875+
].join(',')));
876+
}
874877

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

0 commit comments

Comments
 (0)