summaryrefslogtreecommitdiff
path: root/source/features/edit-files-faster.tsx
diff options
context:
space:
mode:
authorGravatar yakov116 <16872793+yakov116@users.noreply.github.com> 2020-05-20 10:00:22 -0400
committerGravatar GitHub <noreply@github.com> 2020-05-20 16:00:22 +0200
commit641ac1c83d4b2ad8fa36503acfc3253cf579ac60 (patch)
tree14a98f639f0ecf34ac3d9eace49b32cedd6b699e /source/features/edit-files-faster.tsx
parenteef8f4a093df9ada2f68e00052269acf74c8eba5 (diff)
downloadrefined-github-641ac1c83d4b2ad8fa36503acfc3253cf579ac60.tar.gz
refined-github-641ac1c83d4b2ad8fa36503acfc3253cf579ac60.tar.zst
refined-github-641ac1c83d4b2ad8fa36503acfc3253cf579ac60.zip
Drop `replacebranch` in favor of `parseRoute` (#3109)
Co-Authored-By: Fregante <opensource@bfred.it>
Diffstat (limited to 'source/features/edit-files-faster.tsx')
-rw-r--r--source/features/edit-files-faster.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/features/edit-files-faster.tsx b/source/features/edit-files-faster.tsx
index 285607d9..75c1358d 100644
--- a/source/features/edit-files-faster.tsx
+++ b/source/features/edit-files-faster.tsx
@@ -6,7 +6,7 @@ import * as pageDetect from 'github-url-detection';
import {wrap} from '../helpers/dom-utils';
import features from '.';
-import {parseRoute} from '../github-helpers';
+import parseRoute from '../github-helpers/parse-route';
import getDefaultBranch from '../github-helpers/get-default-branch';
import onFileListUpdate from '../github-events/on-file-list-update';
@@ -15,13 +15,13 @@ async function init(): Promise<void> {
const isPermalink = /Tag|Tree/.test(select('.branch-select-menu i')!.textContent!);
for (const fileIcon of select.all('.files :not(a) > .octicon-file')) {
const {pathname} = fileIcon.closest('tr')!.querySelector<HTMLAnchorElement>('.js-navigation-open')!;
- const pathnameParts = parseRoute(pathname);
- pathnameParts[3] = 'edit'; // Replaces /blob/
+ const path = parseRoute(pathname);
+ path.route = 'edit'; // Replaces /blob/
if (isPermalink) {
- pathnameParts[4] = defaultBranch; // Replaces /${tag|commit}/
+ path.branch = defaultBranch; // Replaces /${tag|commit}/
}
- wrap(fileIcon, <a href={pathnameParts.join('/')} className="rgh-edit-files-faster"/>);
+ wrap(fileIcon, <a href={path.toString()} className="rgh-edit-files-faster"/>);
fileIcon.after(<PencilIcon/>);
}
}