From 2f4596c293c725c7c90090426b57a89450c83f1a Mon Sep 17 00:00:00 2001 From: Yakov Kantor <16872793+yakov116@users.noreply.github.com> Date: Mon, 18 May 2020 10:03:37 -0400 Subject: [PATCH 1/2] Add `canUserEditOrganization` and rename `isRepoWithAccess` to `canUserEditRepo` --- index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index ac96ef94..47bc3fd5 100644 --- a/index.ts +++ b/index.ts @@ -315,7 +315,12 @@ collect.set('isRepoTree', [ 'https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/distribution', ]); -export const isRepoWithAccess = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"]'); +export const canUserEditOrganization = (): boolean => isOrganizationProfile() && exists('.pagehead-tabs-item[href$="/settings/profile"]'); + +export const canUserEditRepo = (): 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', [ From 7258a198764b12565b0cae7b7f0ba11e3c58c2a0 Mon Sep 17 00:00:00 2001 From: Fregante Date: Mon, 18 May 2020 18:53:30 +0200 Subject: [PATCH 2/2] Sort --- index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 47bc3fd5..8b8813ef 100644 --- a/index.ts +++ b/index.ts @@ -315,10 +315,6 @@ collect.set('isRepoTree', [ 'https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/distribution', ]); -export const canUserEditOrganization = (): boolean => isOrganizationProfile() && exists('.pagehead-tabs-item[href$="/settings/profile"]'); - -export const canUserEditRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"]'); - /** @deprecated use canUserEditRepo */ export const isRepoWithAccess = canUserEditRepo; @@ -405,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