aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/utils.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-10-22 22:34:01 +0800
committerGitHub <noreply@github.com>2021-10-22 22:34:01 +0800
commit406bd3780e4dedf3efd8f56f6787d350f5aa3524 (patch)
tree10a5b5c6a60c8117f71731f79a2147bcf801f57e /web_src/js/utils.js
parent870f5fbc4146110be37c28e670e57568d3db3288 (diff)
downloadgitea-406bd3780e4dedf3efd8f56f6787d350f5aa3524.tar.gz
gitea-406bd3780e4dedf3efd8f56f6787d350f5aa3524.zip
Fix context popup error (#17398)
* Fix context popup error
Diffstat (limited to 'web_src/js/utils.js')
-rw-r--r--web_src/js/utils.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/web_src/js/utils.js b/web_src/js/utils.js
index b555650bc5..6310b2cb99 100644
--- a/web_src/js/utils.js
+++ b/web_src/js/utils.js
@@ -57,3 +57,9 @@ export function mqBinarySearch(feature, minValue, maxValue, step, unit) {
}
return mqBinarySearch(feature, minValue, mid - step, step, unit); // feature is < mid
}
+
+export function parseIssueHref(href) {
+ const path = (href || '').replace(/[#?].*$/, '');
+ const [_, owner, repo, type, index] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path) || [];
+ return {owner, repo, type, index};
+}