Skip to content

Commit ae70305

Browse files
yakov116fregante
authored andcommitted
Add canUserEditOrganization Rename isRepoWithAccess to canUserEditRepo (#3)
1 parent f88d029 commit ae70305

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,6 @@ collect.set('isRepoTree', [
315315
'https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/distribution',
316316
]);
317317

318-
export const isRepoWithAccess = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"]');
319-
320318
export const isSingleCommit = (url: URL | Location = location): boolean => /^commit\/[\da-f]{5,40}/.test(getRepoPath(url)!);
321319
collect.set('isSingleCommit', [
322320
'https://github.com/sindresorhus/refined-github/commit/5b614b9035f2035b839f48b4db7bd5c3298d526f',
@@ -400,6 +398,13 @@ collect.set('isActionJobRun', [
400398
'https://github.com/sindresorhus/refined-github/runs/639481849',
401399
]);
402400

401+
export const canUserEditOrganization = (): boolean => isOrganizationProfile() && exists('.pagehead-tabs-item[href$="/settings/profile"]');
402+
403+
export const canUserEditRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"]');
404+
405+
/** @deprecated use canUserEditRepo */
406+
export const isRepoWithAccess = canUserEditRepo;
407+
403408
const getUsername = () => document.querySelector('meta[name="user-login"]')!.getAttribute('content')!;
404409

405410
// Drops leading and trailing slash to avoid /\/?/ everywhere

0 commit comments

Comments
 (0)