diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/background.ts | 2 | ||||
-rw-r--r-- | source/features/collapse-markdown-sections.tsx | 2 | ||||
-rw-r--r-- | source/features/enable-file-links-in-compare-view.tsx | 5 | ||||
-rw-r--r-- | source/features/first-published-tag-for-merged-pr.tsx | 2 | ||||
-rw-r--r-- | source/features/link-to-changelog-file.tsx | 2 | ||||
-rw-r--r-- | source/features/more-dropdown.css | 7 | ||||
-rw-r--r-- | source/features/restore-file.tsx | 2 | ||||
-rw-r--r-- | source/features/safer-destructive-actions.css | 6 | ||||
-rw-r--r-- | source/features/table-input.tsx | 5 | ||||
-rw-r--r-- | source/helpers/fetch-dom.ts | 3 | ||||
-rw-r--r-- | source/options-storage.ts | 3 | ||||
-rw-r--r-- | source/options.tsx | 1 |
12 files changed, 14 insertions, 26 deletions
diff --git a/source/background.ts b/source/background.ts index f1fa00ec..e45cd740 100644 --- a/source/background.ts +++ b/source/background.ts @@ -3,7 +3,7 @@ import cache from 'webext-storage-cache'; // Also needed to regularly clear the import addDomainPermissionToggle from 'webext-domain-permission-toggle'; import './options-storage'; -// GitHub Enterprise support +// GHE support addDomainPermissionToggle(); const messageHandlers = { diff --git a/source/features/collapse-markdown-sections.tsx b/source/features/collapse-markdown-sections.tsx index 97ebf8d1..e96b6116 100644 --- a/source/features/collapse-markdown-sections.tsx +++ b/source/features/collapse-markdown-sections.tsx @@ -37,7 +37,7 @@ function onHeadingClick(event: delegate.Event<MouseEvent, HTMLElement>): void { function init(): void { delegate(document, '.markdown-body > :is(h1, h2, h3, h4, h5, h6)', 'click', onHeadingClick); - document.body.classList.add('.rgh-' + __filebasename); + document.body.classList.add('rgh-' + __filebasename); } void features.add(__filebasename, { diff --git a/source/features/enable-file-links-in-compare-view.tsx b/source/features/enable-file-links-in-compare-view.tsx index 2bf1edb8..36c6e243 100644 --- a/source/features/enable-file-links-in-compare-view.tsx +++ b/source/features/enable-file-links-in-compare-view.tsx @@ -60,8 +60,9 @@ void features.add(__filebasename, { pageDetect.isPRCommit ], exclude: [ - // Only enabled on Open/Draft PRs. Editing files doesn't make sense after a PR is closed/merged. - () => !select.exists('.gh-header-meta [title$="Open"], .gh-header-meta [title$="Draft"]'), + // Editing files doesn't make sense after a PR is closed/merged + pageDetect.isClosedPR, + () => select('.head-ref')!.title === 'This repository has been deleted', // If you're viewing changes from partial commits, ensure you're on the latest one. () => select.exists('.js-commits-filtered') && !select.exists('[aria-label="You are viewing the latest commit"]') ], diff --git a/source/features/first-published-tag-for-merged-pr.tsx b/source/features/first-published-tag-for-merged-pr.tsx index 135bbc1a..b2defe10 100644 --- a/source/features/first-published-tag-for-merged-pr.tsx +++ b/source/features/first-published-tag-for-merged-pr.tsx @@ -10,7 +10,7 @@ import {buildRepoURL, getRepo} from '../github-helpers'; import onConversationHeaderUpdate from '../github-events/on-conversation-header-update'; const getFirstTag = cache.function(async (commit: string): Promise<string | undefined> => { - const firstTag = await fetchDom<HTMLAnchorElement>( + const firstTag = await fetchDom( buildRepoURL('branch_commits', commit), 'ul.branches-tag-list li:last-child a' ); diff --git a/source/features/link-to-changelog-file.tsx b/source/features/link-to-changelog-file.tsx index 6c57fb5a..9318c5cf 100644 --- a/source/features/link-to-changelog-file.tsx +++ b/source/features/link-to-changelog-file.tsx @@ -68,7 +68,7 @@ async function init(): Promise<void | false> { style={{padding: '6px 16px'}} role="button" > - <BookIcon className="text-blue mr-2"/> + <BookIcon className="text-blue color-text-link mr-2"/> <span>Changelog</span> </a> ); diff --git a/source/features/more-dropdown.css b/source/features/more-dropdown.css index cbac5ada..3787e19a 100644 --- a/source/features/more-dropdown.css +++ b/source/features/more-dropdown.css @@ -1,10 +1,3 @@ -/* Fix pre-existing items' positioning on GHE */ -.reponav-dropdown a.dropdown-item:not(.rgh-reponav-more)::before { - content: ''; - display: inline-block; - width: 16px; -} - /* Always show the overflow menu button */ .rgh-has-more-dropdown .js-responsive-underlinenav-overflow { visibility: visible !important; diff --git a/source/features/restore-file.tsx b/source/features/restore-file.tsx index f505b15d..0de3c764 100644 --- a/source/features/restore-file.tsx +++ b/source/features/restore-file.tsx @@ -57,7 +57,7 @@ async function commitFileContent(menuItem: Element, content: string, filePath: s } // This is either an `edit` or `create` form - const form = (await fetchDom<HTMLFormElement>(pathname, '.js-blob-form'))!; + const form = (await fetchDom(pathname, 'form.js-blob-form'))!; form.elements.value.value = content; // Restore content (`value` is the name of the file content field) form.elements.message.value = (form.elements.message as HTMLInputElement).placeholder .replace(/^Create|^Update/, 'Restore'); diff --git a/source/features/safer-destructive-actions.css b/source/features/safer-destructive-actions.css index 3fe2ceb6..6998f50a 100644 --- a/source/features/safer-destructive-actions.css +++ b/source/features/safer-destructive-actions.css @@ -1,12 +1,6 @@ /* Move "close issue" and "cancel" buttons on authoring comments to the left */ /* ...in issue comment form */ -/* the legacy way (kept for GitHub Enterprise) */ -.form-actions .btn.js-comment-and-button { - float: left; -} - -/* the current github.com way */ #partial-new-comment-form-actions > .d-flex { justify-content: space-between !important; } diff --git a/source/features/table-input.tsx b/source/features/table-input.tsx index f2ec4f26..1079d69b 100644 --- a/source/features/table-input.tsx +++ b/source/features/table-input.tsx @@ -2,6 +2,7 @@ import './table-input.css'; import React from 'dom-chef'; import select from 'select-dom'; import delegate from 'delegate-it'; +import {TableIcon} from '@primer/octicons-react'; import * as pageDetect from 'github-url-detection'; import * as textFieldEdit from 'text-field-edit'; @@ -48,9 +49,7 @@ function init(): void { className="tooltipped tooltipped-n" aria-label="Add a table" > - <svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" className="octicon"> - <path d="m2.75 1c-0.9665 0-1.75 0.7835-1.75 1.75v10.5c0 0.9665 0.7835 1.75 1.75 1.75h10.5c0.9665 0 1.75-0.7835 1.75-1.75v-10.5c0-0.9665-0.7835-1.75-1.75-1.75h-10.5zm0 1.5h4.5v4.75h-4.75v-4.5c0-0.13807 0.11193-0.25 0.25-0.25zm6 0h4.5c0.1381 0 0.25 0.11193 0.25 0.25v4.5h-4.75v-4.75zm-6.25 6.25h4.75v4.75h-4.5c-0.13807 0-0.25-0.1119-0.25-0.25v-4.5zm6.25 0h4.75v4.5c0 0.1381-0.1119 0.25-0.25 0.25h-4.5v-4.75z"/> - </svg> + <TableIcon/> </div> </summary> <details-menu className="select-menu-modal position-absolute left-0 hx_rsm-modal rgh-table-input" role="menu"> diff --git a/source/helpers/fetch-dom.ts b/source/helpers/fetch-dom.ts index 9d901496..9de536ca 100644 --- a/source/helpers/fetch-dom.ts +++ b/source/helpers/fetch-dom.ts @@ -1,8 +1,9 @@ import mem from 'mem'; import domify from 'doma'; +import type {ParseSelector} from 'typed-query-selector/parser'; async function fetchDom(url: string): Promise<DocumentFragment>; -async function fetchDom<TElement extends Element>(url: string, selector: string): Promise<TElement | undefined>; +async function fetchDom<Selector extends string, TElement extends Element = ParseSelector<Selector>>(url: string, selector: Selector): Promise<TElement | undefined>; async function fetchDom(url: string, selector?: string): Promise<Node | undefined> { const absoluteURL = new URL(url, location.origin).toString(); // Firefox `fetch`es from the content script, so relative URLs fail const response = await fetch(absoluteURL); diff --git a/source/options-storage.ts b/source/options-storage.ts index 291a8dff..2d950d1b 100644 --- a/source/options-storage.ts +++ b/source/options-storage.ts @@ -17,9 +17,8 @@ const defaults = Object.assign({ logging: false }, Object.fromEntries(__features__.map(id => [`feature:${id}`, true]))); -// TODO[2021-10-01]: Drop classes `muted-link`, `link-gray`, `link-gray-dark`, `text-gray`, `text-gray-light`, `text-gray-dark`, `text-green`, `text-red` #4021 +// TODO[2021-10-01]: Drop classes `muted-link`, `link-gray`, `link-gray-dark`, `text-gray`, `text-gray-light`, `text-gray-dark`, `text-green`, `text-red` `text-blue` #4021 const migrations = [ - featureWasRenamed('pr-easy-toggle-files', 'easy-toggle-files'), // Merged in December featureWasRenamed('cleanup-repo-filelist-actions', 'clean-repo-filelist-actions'), // Merged in February featureWasRenamed('batch-open-conversations', 'open-all-conversations'), // Merged in March diff --git a/source/options.tsx b/source/options.tsx index 27414276..cb14365d 100644 --- a/source/options.tsx +++ b/source/options.tsx @@ -58,6 +58,7 @@ async function getTokenScopes(personalToken: string): Promise<string[]> { } const scopes = response.headers.get('X-OAuth-Scopes')!.split(', '); + scopes.push('valid_token'); if (scopes.includes('repo')) { scopes.push('public_repo'); } |