Skip to content

Commit

Permalink
Drop fallback code for old GitHub Enterprise versions (#4864)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Oct 4, 2021
1 parent c1f3484 commit d3bc037
Show file tree
Hide file tree
Showing 45 changed files with 49 additions and 67 deletions.
2 changes: 1 addition & 1 deletion source/features/action-used-by-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function init(): void {

select('.d-block.mb-2[href^="/contact"]')!.after(
<a href={String(actionURL)} className="d-block mb-2">
<SearchIcon width={14} className="text-gray-dark color-text-primary mr-2"/>Usage examples
<SearchIcon width={14} className="color-text-primary mr-2"/>Usage examples
</a>,
);
}
Expand Down
1 change: 0 additions & 1 deletion source/features/align-issue-labels.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
margin-left: 4px;
}

.rgh-align-issue-labels .js-issue-row .mt-1.text-small.text-gray, /* GHE #4026 */
.rgh-align-issue-labels .js-issue-row .mt-1.text-small.color-text-secondary { /* Issue details line */
flex-basis: 100%;
}
Expand Down
3 changes: 1 addition & 2 deletions source/features/center-reactions-popup.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Hide reaction popover text */
.js-add-reaction-popover .text-gray, /* GHE #4021 */
.js-add-reaction-popover .color-text-secondary,
.js-add-reaction-popover .dropdown-divider {
display: none;
Expand Down Expand Up @@ -55,5 +54,5 @@ td.js-line-comments:last-child .timeline-comment-actions .add-reaction-popover::
/* Keep colored button when reaction popup is open */
.dropdown-details[open] .timeline-comment-action {
opacity: 100%;
color: var(--color-mktg-btn-bg, #4078c0); /* GHE #4121 */
color: var(--color-mktg-btn-bg, #4078c0);
}
4 changes: 2 additions & 2 deletions source/features/clean-conversation-headers.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:root .rgh-clean-conversation-headers-non-default-branch {
background-color: var(--color-state-hover-primary-bg, #0366d6); /* GHE #4121 */
background-color: var(--color-state-hover-primary-bg, #0366d6);
}

.rgh-clean-conversation-headers-non-default-branch a {
color: var(--color-state-hover-primary-text, #fff); /* GHE #4121 */
color: var(--color-state-hover-primary-text, #fff);
}
4 changes: 0 additions & 4 deletions source/features/clean-dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* `.js-news-feed-event-group` is only for grouped events
*/

/* GHE #4021 */
.rgh-clean-dashboard .dashboard :is(.watch_started, .repo, .public) .color-border-secondary.flex-items-baseline .text-bold.text-gray-dark,
/* Hide duplicate repo name in some non-grouped events */
.rgh-clean-dashboard .dashboard :is(.watch_started, .repo, .public) .color-border-secondary.flex-items-baseline .text-bold.color-text-primary {
display: none;
Expand Down Expand Up @@ -52,13 +50,11 @@
}

/* Hide footer date on Created Repository events */
.rgh-clean-dashboard .dashboard .repo .f6.text-gray, /* GHE #4021 */
.rgh-clean-dashboard .dashboard .repo .f6.color-text-secondary {
display: none;
}

/* Grouped events: Make repo name smaller */
.rgh-clean-dashboard .dashboard .Details .flex-items-baseline .text-bold.text-gray-dark, /* GHE #4021 */
.rgh-clean-dashboard .dashboard .Details .flex-items-baseline .text-bold.color-text-primary {
font-size: 1em !important;
}
Expand Down
2 changes: 1 addition & 1 deletion source/features/clean-footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ body > .footer > div > ul:first-of-type li:first-of-type { /* The `© 2017 GitHu

body > .footer li a,
body > .footer li .btn-link {
color: var(--color-text-disabled, #666); /* GHE #4121 */
color: var(--color-text-disabled, #666);
}
1 change: 0 additions & 1 deletion source/features/clean-mergeability-box.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
font-weight: 600;
}

.mergeability-details .js-details-container .text-red + .status-meta, /* GHE #4121 */
.mergeability-details .js-details-container .color-text-danger + .status-meta {
color: var(--github-red);
}
Expand Down
4 changes: 2 additions & 2 deletions source/features/clean-repo-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import features from '.';

async function removeReadmeLink(): Promise<void> {
// Hide "Readme" link made unnecessary by toggle-files-button #3580
(await elementReady('.muted-link[href="#readme"], .Link--muted[href="#readme"]'))?.parentElement!.remove();
(await elementReady('.Link--muted[href="#readme"]'))?.parentElement!.remove();
}

async function cleanLicenseText(): Promise<void> {
Expand Down Expand Up @@ -45,7 +45,7 @@ async function cleanReleases(): Promise<void> {
}

// Align latest tag icon with the icons of other meta links
const tagIcon = select('.octicon-tag:not(:is(.text-green, .color-text-success))', releasesSection)!;
const tagIcon = select('.octicon-tag:not(.color-text-success)', releasesSection)!;
if (tagIcon) {
tagIcon.classList.add('mr-2');
// Remove whitespace node
Expand Down
2 changes: 1 addition & 1 deletion source/features/clone-branch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async function init(): Promise<void | false> {
<button
type="button"
aria-label="Clone this branch"
className="link-gray Link--secondary btn-link tooltipped tooltipped-nw ml-3 rgh-clone-branch"
className="Link--secondary btn-link tooltipped tooltipped-nw ml-3 rgh-clone-branch"
>
<GitBranchIcon/>
</button>,
Expand Down
2 changes: 1 addition & 1 deletion source/features/conflict-marker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function init(): Promise<false | void> {
if (data[pr.key].pullRequest.mergeable === 'CONFLICTING') {
pr.link.after(
<a
className="rgh-conflict-marker tooltipped tooltipped-e text-gray color-text-secondary ml-2"
className="rgh-conflict-marker tooltipped tooltipped-e color-text-secondary ml-2"
aria-label="This PR has conflicts that must be resolved"
href={`${pr.link.pathname}#partial-pull-merging`}
>
Expand Down
4 changes: 2 additions & 2 deletions source/features/conversation-links-on-repo-lists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ function init(): void {
// Place before the "Updated on" element
select('relative-time', repository)!.previousSibling!.before(
<a
className="muted-link Link--muted mr-3"
className="Link--muted mr-3"
href={repositoryLink.href + '/issues?q=is%3Aissue+is%3Aopen'}
>
<IssueOpenedIcon/>
</a>,
<a
className="muted-link Link--muted mr-3"
className="Link--muted mr-3"
href={repositoryLink.href + '/pulls?q=is%3Apr+is%3Aopen'}
>
<GitPullRequestIcon/>
Expand Down
2 changes: 1 addition & 1 deletion source/features/convert-pr-to-draft-improvements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function init(): void {

alternativeActions.classList.add('rgh-convert-pr-draft-position');
const convertToDraft = existingButton.closest('details')!.cloneNode(true);
select('.muted-link, .Link--muted', convertToDraft)!.classList.remove('muted-link', 'Link--muted');
select('.Link--muted', convertToDraft)!.classList.remove('Link--muted');
alternativeActions.prepend(convertToDraft);
},
});
Expand Down
4 changes: 2 additions & 2 deletions source/features/deep-reblame.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
button.rgh-deep-reblame .octicon-versions {
color: var(--color-scale-pink-5, #e40de4); /* GHE #4121 */
color: var(--color-scale-pink-5, #e40de4);
opacity: 70%;
}

.rgh-deep-reblame:hover .octicon-versions {
color: var(--color-scale-pink-7, #800080); /* GHE #4121 */
color: var(--color-scale-pink-7, #800080);
opacity: 70%;
}
1 change: 0 additions & 1 deletion source/features/easier-pr-sha-copy.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* Add margin to commit SHA to reduce likelihood of selection overflow #2508 */
.repository-content .js-commit .text-right code .link-gray, /* GHE #4021 */
.repository-content .js-commit .text-right code .Link--secondary {
margin-right: 16px;
}
6 changes: 3 additions & 3 deletions source/features/extend-diff-expander.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hovering the line will highlight the first direction button, unless you hover the buttons directly */
.js-expandable-line:hover .blob-num:not(:hover) .directional-expander:first-child,
.js-expandable-line:hover .blob-num:not(:hover) + .blob-code {
color: var(--color-state-hover-primary-text, #fff); /* GHE #4121 */
background: var(--color-state-hover-primary-bg, #0366d6); /* GHE #4121 */
border-color: var(--color-state-hover-primary-border, #0366d6); /* GHE #4121 */
color: var(--color-state-hover-primary-text, #fff);
background: var(--color-state-hover-primary-bg, #0366d6);
border-color: var(--color-state-hover-primary-border, #0366d6);
cursor: pointer;
}
2 changes: 1 addition & 1 deletion source/features/first-published-tag-for-merged-pr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function init(): Promise<void> {

discussionHeader.parentElement!.append(
' • ',
<TagIcon className="mx-1 text-gray color-text-secondary"/>,
<TagIcon className="mx-1 color-text-secondary"/>,
<a
href={buildRepoURL('releases/tag', tagName)}
className="commit-ref"
Expand Down
4 changes: 2 additions & 2 deletions source/features/git-checkout-pr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function checkoutOption(remote?: string, remoteType?: 'HTTPS' | 'SSH'): JSX.Elem
const [owner] = nameWithOwner.split('/');
return (
<div className="markdown-body">
{remote && <p className="text-gray color-text-secondary text-small my-1">{remoteType}</p>}
{remote && <p className="color-text-secondary text-small my-1">{remoteType}</p>}
<div className="snippet-clipboard-content position-relative">
<div className="zeroclipboard-container position-absolute right-0 top-0">
<clipboard-copy
Expand Down Expand Up @@ -78,7 +78,7 @@ async function handleMenuOpening({delegateTarget: dropdown}: delegate.Event): Pr
Checkout with Git
</span>
<div className="mt-2 pl-5">
<p className="text-gray color-text-secondary text-small">
<p className="color-text-secondary text-small">
Run in your project repository{remoteName && ', pick either one'}
</p>
{remoteName ? [
Expand Down
2 changes: 1 addition & 1 deletion source/features/hide-low-quality-comments.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.rgh-low-quality-comments-note {
margin: 15px 0 10px 60px;
font-size: 12px;
color: var(--color-text-secondary, #586069); /* GHE #4121 */
color: var(--color-text-secondary, #586069);
}

.rgh-hidden-comment .timeline-comment {
Expand Down
2 changes: 1 addition & 1 deletion source/features/highest-rated-comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function linkBestComment(bestComment: HTMLElement): void {
<ArrowDownIcon/>
</span>

<span className="text-gray color-text-secondary timeline-comment-header-text">
<span className="color-text-secondary timeline-comment-header-text">
Highest-rated comment: <em>{text}</em>
</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async function init(): Promise<void | false> {
const icon = sourceIcon.cloneNode(true);
const action = icon.getAttribute('title')!;
if (action === 'added') {
icon.classList.add('text-green', 'color-text-success');
icon.classList.add('color-text-success');
} else if (action === 'removed') {
icon.classList.add('text-red', 'color-text-danger');
icon.classList.add('color-text-danger');
} else {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion source/features/highlight-non-default-base-branch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function init(): Promise<false | void> {

const branch = pr.baseRef && buildRepoURL(`tree/${pr.baseRefName}`);

prLink.parentElement!.querySelector(':is(.text-small.color-text-secondary, .text-small.text-gray) .d-none.d-md-inline-flex')!.append(
prLink.parentElement!.querySelector('.text-small.color-text-secondary .d-none.d-md-inline-flex')!.append(
<span className="issue-meta-section ml-2">
<GitPullRequestIcon/>
{' To '}
Expand Down
2 changes: 1 addition & 1 deletion source/features/link-to-changelog-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function init(): Promise<void | false> {
style={{padding: '6px 16px'}}
role="button"
>
<BookIcon className="text-blue color-text-link mr-2"/>
<BookIcon className="color-text-link mr-2"/>
<span>Changelog</span>
</a>,
);
Expand Down
2 changes: 1 addition & 1 deletion source/features/linkify-user-edit-history-popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function init(): void {
add(avatar) {
const userName = avatar.alt.slice(1);
// Linkify name first
wrap(avatar.nextElementSibling!, <a className="link-gray-dark Link--primary" href={`/${userName}`}/>);
wrap(avatar.nextElementSibling!, <a className="Link--primary" href={`/${userName}`}/>);

// Then linkify avatar
wrap(avatar, <a href={`/${userName}`}/>);
Expand Down
6 changes: 3 additions & 3 deletions source/features/list-pr-for-branch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {getPullRequestsAssociatedWithBranch, stateIcon} from './show-associated-

// Taken from https://github.com/fregante/github-issue-link-status/blob/98792f2837352bacbf80664f3edbcec8e579ed17/source/github-issue-link-status.js#L10
const stateColorMap = {
OPEN: 'text-green color-text-success',
CLOSED: 'text-red color-text-danger',
MERGED: 'text-purple color-purple-5',
OPEN: 'color-text-success',
CLOSED: 'color-text-danger',
MERGED: 'color-purple-5',
DRAFT: '',
};

Expand Down
2 changes: 1 addition & 1 deletion source/features/mark-merge-commits-in-list.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
}

.rgh-merge-commit .octicon-git-pull-request {
color: var(--color-icon-info, #4078c0); /* GHE #4121 */
color: var(--color-icon-info, #4078c0);
width: 20px;
}
4 changes: 0 additions & 4 deletions source/features/parse-backticks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ function init(): void {
'.js-commit-group pre', // `isPRConversation` commit description
'.release-header', // `isReleasesOrTags` Headers
'.Box-row .mb-1 a', // `isCompare` with existing PR
'#pull-requests a.link-gray-dark', // `isPulse` issue and PR title (GHE #4021)
'#pull-requests a.Link--primary', // `isPulse` issue and PR title
'[id^="check_suite"] a.link-gray-dark', // `isRepositoryActions` (GHE #4021)
'[id^="check_suite"] a.Link--primary', // `isRepositoryActions`
'.js-socket-channel[data-url*="/header_partial"] h3', // `isActions` run
'.js-wiki-sidebar-toggle-display a', // `isWiki` sidebar pages title
'#wiki-wrapper .gh-header-title', // `isWiki` page title
'.issues_labeled .text-gray-dark > a', // `isDashboard` "help wanted" event titles (GHE #4021)
'.issues_labeled .color-text-primary > a', // `isDashboard` "help wanted" event titles
'#user-repositories-list [itemprop="description"]', // `isUserProfileRepoTab` repository description
'.js-hovercard-content > .Popover-message .link-gray-dark', // Hovercard (GHE #4021)
'.js-hovercard-content > .Popover-message .Link--primary', // Hovercard
'.js-discussions-title-container h1 > .js-issue-title', // `isDiscussion`
'a[data-hovercard-type="discussion"]', // `isDiscussionList`
Expand Down
2 changes: 1 addition & 1 deletion source/features/pinned-issues-update-time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function init(): Promise<void | false> {
const {updatedAt} = lastUpdated[api.escapeKey(issueNumber)];
select('.pinned-item-desc', pinnedIssue)!.append(
' • ',
<span className="text-gray color-text-secondary d-inline-block">
<span className="color-text-secondary d-inline-block">
updated <relative-time datetime={updatedAt}/>
</span>,
);
Expand Down
3 changes: 0 additions & 3 deletions source/features/pr-approvals-count.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* Show approvals count in PR list */
.js-issue-row .text-gray [href$='#partial-pull-merging'][aria-label*='approval'], /* GHE #4021 */
.js-issue-row .color-text-secondary [href$='#partial-pull-merging'][aria-label*='approval'] {
font-size: 0;
}

.js-issue-row .text-gray [href$='#partial-pull-merging'][aria-label*='approval']::before, /* GHE #4021 */
.js-issue-row .color-text-secondary [href$='#partial-pull-merging'][aria-label*='approval']::before {
all: unset;
content: attr(aria-label);
Expand All @@ -13,7 +11,6 @@
font-size: 12px;
}

.js-issue-row .text-gray [href$='#partial-pull-merging'][aria-label*='changes'], /* GHE #4021 */
.js-issue-row .color-text-secondary [href$='#partial-pull-merging'][aria-label*='changes'] {
color: var(--github-red) !important;
}
Expand Down
4 changes: 2 additions & 2 deletions source/features/pr-commit-lines-changed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ async function init(): Promise<void> {
const diffstat = await elementReady('.diffstat', {waitForChildren: false});
diffstat!.replaceWith(
<span className="ml-2 diffstat tooltipped tooltipped-s" aria-label={tooltip}>
<span className="text-green color-text-success">+{additions}</span>{' '}
<span className="text-red color-text-danger">{deletions}</span>{' '}
<span className="color-text-success">+{additions}</span>{' '}
<span className="color-text-danger">{deletions}</span>{' '}
<span className="diffstat-block-neutral"/>
<span className="diffstat-block-neutral"/>
<span className="diffstat-block-neutral"/>
Expand Down
2 changes: 1 addition & 1 deletion source/features/quick-comment-hiding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function generateSubmenu(hideButton: Element): void {
select('[name="classifier"]', hideCommentForm)!.remove();

// Imitate existing menu
hideCommentForm.classList.add('dropdown-menu', 'dropdown-menu-sw', 'text-gray-dark', 'color-text-primary', 'show-more-popover', 'anim-scale-in');
hideCommentForm.classList.add('dropdown-menu', 'dropdown-menu-sw', 'color-text-primary', 'show-more-popover', 'anim-scale-in');

detailsElement.append(hideCommentForm);
}
Expand Down
2 changes: 1 addition & 1 deletion source/features/quick-pr-diff-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function createWhitespaceButton(): HTMLElement {

const classes = pageDetect.isPR()
? 'tooltipped tooltipped-s d-none d-lg-block color-icon-secondary ' + (isHidingWhitespace ? '' : 'color-icon-info')
: 'tooltipped tooltipped-s btn btn-sm tooltipped ' + (isHidingWhitespace ? 'bg-gray-light text-gray-light color-text-tertiary' : '');
: 'tooltipped tooltipped-s btn btn-sm tooltipped ' + (isHidingWhitespace ? 'bg-gray-light color-text-tertiary' : '');

return (
<a
Expand Down
2 changes: 1 addition & 1 deletion source/features/quick-review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function addSidebarReviewButton(): Promise<void | false> {

sidebarReviewsSection!.append(
<span style={{fontWeight: 'normal'}}>
<a href={reviewFormUrl.href} className="btn-link muted-link Link--muted" data-hotkey="v">review now</a>
<a href={reviewFormUrl.href} className="btn-link Link--muted" data-hotkey="v">review now</a>
</span>,
);
}
Expand Down
2 changes: 1 addition & 1 deletion source/features/release-download-count.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function init(): Promise<void | false> {
// Match the asset in the DOM to the asset in the API response
for (const [index, {name, downloadCount}] of sortedDownloads.entries()) {
if (name === assetName.textContent && downloadCount > 0) {
const classes = 'rgh-release-download-count mr-2 text-gray color-text-secondary' + (index === 0 ? ' text-bold' : '');
const classes = 'rgh-release-download-count mr-2 color-text-secondary' + (index === 0 ? ' text-bold' : '');
// Place next to asset size
assetName
.closest('.Box-body')!
Expand Down
2 changes: 1 addition & 1 deletion source/features/repo-age.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function init(): Promise<void> {
sidebarAboutSection!.append(
<h3 className="sr-only">Repository age</h3>,
<div className="mt-3">
<a href={firstCommitHref} className="muted-link Link--muted" title={`First commit dated ${dateFormatter.format(birthday)}`}>
<a href={firstCommitHref} className="Link--muted" title={`First commit dated ${dateFormatter.format(birthday)}`}>
<RepoIcon className="mr-2"/>{age}
</a>
</div>,
Expand Down
2 changes: 1 addition & 1 deletion source/features/submit-review-as-single-comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import features from '.';
const pendingSelector = '.timeline-comment-label.is-pending';

const getButton = onetime(() => (
<button className="rgh-submit-single btn-link ml-2 text-gray color-text-secondary text-small" type="button">Send now</button>
<button className="rgh-submit-single btn-link ml-2 color-text-secondary text-small" type="button">Send now</button>
));

function updateUI(): void {
Expand Down
2 changes: 1 addition & 1 deletion source/features/sync-pr-commit-title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function needsSubmission(): boolean {
function getUI(): HTMLElement {
return select(`${mergeFormSelector} .rgh-sync-pr-commit-title-note`) ?? (
<p className="note rgh-sync-pr-commit-title-note">
The title of this PR will be updated to match this title. <button type="button" className="btn-link muted-link Link--muted text-underline rgh-sync-pr-commit-title">Cancel</button>
The title of this PR will be updated to match this title. <button type="button" className="btn-link Link--muted text-underline rgh-sync-pr-commit-title">Cancel</button>
</p>
);
}
Expand Down

0 comments on commit d3bc037

Please sign in to comment.