Skip to content

Commit d29080f

Browse files
fix some issue/pull URLs in javascript
1 parent bb9b941 commit d29080f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

web_src/js/components/ContextPopup.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ async function load(issuePathInfo: IssuePathInfo) {
3737
i18nErrorMessage.value = null;
3838
3939
try {
40-
const response = await GET(`${appSubUrl}/${issuePathInfo.ownerName}/${issuePathInfo.repoName}/issues/${issuePathInfo.indexString}/info`); // backend: GetIssueInfo
40+
const groupSegment = issuePathInfo.group ? `group/${issuePathInfo.group}/` : '';
41+
const response = await GET(`${appSubUrl}/${issuePathInfo.ownerName}/${groupSegment}${issuePathInfo.repoName}/issues/${issuePathInfo.indexString}/info`); // backend: GetIssueInfo
4142
const respJson = await response.json();
4243
if (!response.ok) {
4344
i18nErrorMessage.value = respJson.message ?? i18n.network_error;

web_src/js/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export type RepoOwnerPathInfo = {
4040
export type IssuePathInfo = {
4141
ownerName: string,
4242
repoName: string,
43+
group: string,
4344
pathType: string,
4445
indexString?: string,
4546
}

web_src/js/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export function stripTags(text: string): string {
4141
export function parseIssueHref(href: string): IssuePathInfo {
4242
// FIXME: it should use pathname and trim the appSubUrl ahead
4343
const path = (href || '').replace(/[#?].*$/, '');
44-
const [_, ownerName, repoName, pathType, indexString] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path) || [];
45-
return {ownerName, repoName, pathType, indexString};
44+
const [_, ownerName, group, repoName, pathType, indexString] = /([^/]+)\/(?:group\/([^/]+)\/)?([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path) || [];
45+
return {ownerName, repoName, pathType, group, indexString};
4646
}
4747

4848
export function parseRepoOwnerPathInfo(pathname: string): RepoOwnerPathInfo {

0 commit comments

Comments
 (0)