diff --git a/index.ts b/index.ts index ac96ef94..8b8813ef 100644 --- a/index.ts +++ b/index.ts @@ -315,7 +315,8 @@ collect.set('isRepoTree', [ 'https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/distribution', ]); -export const isRepoWithAccess = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"]'); +/** @deprecated use canUserEditRepo */ +export const isRepoWithAccess = canUserEditRepo; export const isSingleCommit = (url: URL | Location = location): boolean => /^commit\/[\da-f]{5,40}/.test(getRepoPath(url)!); collect.set('isSingleCommit', [ @@ -400,6 +401,10 @@ collect.set('isActionJobRun', [ 'https://github.com/sindresorhus/refined-github/runs/639481849', ]); +export const canUserEditOrganization = (): boolean => isOrganizationProfile() && exists('.pagehead-tabs-item[href$="/settings/profile"]'); + +export const canUserEditRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"]'); + const getUsername = () => document.querySelector('meta[name="user-login"]')!.getAttribute('content')!; // Drops leading and trailing slash to avoid /\/?/ everywhere