summaryrefslogtreecommitdiff
path: root/source/features/enable-file-links-in-compare-view.tsx
diff options
context:
space:
mode:
authorGravatar yakov116 <16872793+yakov116@users.noreply.github.com> 2020-10-26 08:40:40 -0400
committerGravatar GitHub <noreply@github.com> 2020-10-26 08:40:40 -0400
commitde5c0b49d754a8996f20742bb19b1b33d175969b (patch)
treeeb75f4499680ca503c4828bfb895643644a7e271 /source/features/enable-file-links-in-compare-view.tsx
parenta38bf75cea20ed97314ed949ee5b3c63faf8962b (diff)
downloadrefined-github-de5c0b49d754a8996f20742bb19b1b33d175969b.tar.gz
refined-github-de5c0b49d754a8996f20742bb19b1b33d175969b.tar.zst
refined-github-de5c0b49d754a8996f20742bb19b1b33d175969b.zip
Lint (#3684)
Co-authored-by: Federico <me@fregante.com>
Diffstat (limited to 'source/features/enable-file-links-in-compare-view.tsx')
-rw-r--r--source/features/enable-file-links-in-compare-view.tsx6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/features/enable-file-links-in-compare-view.tsx b/source/features/enable-file-links-in-compare-view.tsx
index b6175d23..ac4bb98e 100644
--- a/source/features/enable-file-links-in-compare-view.tsx
+++ b/source/features/enable-file-links-in-compare-view.tsx
@@ -6,17 +6,15 @@ import * as pageDetect from 'github-url-detection';
import features from '.';
import GitHubURL from '../github-helpers/github-url';
-import {getCurrentBranch} from '../github-helpers';
+import {getCurrentBranch, getPRRepositoryInfo} from '../github-helpers';
/** Rebuilds the "View file" link because it points to the base repo and to the commit, instead of the head repo and its branch */
function handlePRMenuOpening({delegateTarget: dropdown}: delegate.Event): void {
dropdown.classList.add('rgh-actionable-link'); // Mark this as processed
-
- const [, user, repository] = select<HTMLAnchorElement>('.commit-ref.head-ref a')!.pathname.split('/', 3);
const filePath = dropdown.closest('[data-path]')!.getAttribute('data-path')!;
const viewFile = select<HTMLAnchorElement>('[data-ga-click^="View file"]', dropdown)!;
- viewFile.pathname = [user, repository, 'blob', getCurrentBranch()!, filePath].join('/'); // Do not replace with `GitHubURL` #3152 #3111 #2595
+ viewFile.pathname = [getPRRepositoryInfo().url!, 'blob', getCurrentBranch()!, filePath].join('/'); // Do not replace with `GitHubURL` #3152 #3111 #2595
}
function handleCompareMenuOpening({delegateTarget: dropdown}: delegate.Event): void {