mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-05 20:16:45 +08:00
Refactor issue page info (#32445)
Fix a longstanding TODO since 2021 (#14826) / 2018 (#2531)
This commit is contained in:
@ -3,8 +3,8 @@ import {svg} from '../svg.ts';
|
||||
import {showErrorToast} from '../modules/toast.ts';
|
||||
import {GET, POST} from '../modules/fetch.ts';
|
||||
import {showElem} from '../utils/dom.ts';
|
||||
import {parseIssuePageInfo} from '../utils.ts';
|
||||
|
||||
const {appSubUrl} = window.config;
|
||||
let i18nTextEdited;
|
||||
let i18nTextOptions;
|
||||
let i18nTextDeleteFromHistory;
|
||||
@ -121,15 +121,14 @@ function showContentHistoryMenu(issueBaseUrl, $item, commentId) {
|
||||
}
|
||||
|
||||
export async function initRepoIssueContentHistory() {
|
||||
const issueIndex = $('#issueIndex').val();
|
||||
if (!issueIndex) return;
|
||||
const issuePageInfo = parseIssuePageInfo();
|
||||
if (!issuePageInfo.issueNumber) return;
|
||||
|
||||
const $itemIssue = $('.repository.issue .timeline-item.comment.first'); // issue(PR) main content
|
||||
const $comments = $('.repository.issue .comment-list .comment'); // includes: issue(PR) comments, review comments, code comments
|
||||
if (!$itemIssue.length && !$comments.length) return;
|
||||
|
||||
const repoLink = $('#repolink').val();
|
||||
const issueBaseUrl = `${appSubUrl}/${repoLink}/issues/${issueIndex}`;
|
||||
const issueBaseUrl = `${issuePageInfo.repoLink}/issues/${issuePageInfo.issueNumber}`;
|
||||
|
||||
try {
|
||||
const response = await GET(`${issueBaseUrl}/content-history/overview`);
|
||||
|
@ -4,7 +4,7 @@ import {createTippy, showTemporaryTooltip} from '../modules/tippy.ts';
|
||||
import {hideElem, showElem, toggleElem} from '../utils/dom.ts';
|
||||
import {setFileFolding} from './file-fold.ts';
|
||||
import {ComboMarkdownEditor, getComboMarkdownEditor, initComboMarkdownEditor} from './comp/ComboMarkdownEditor.ts';
|
||||
import {toAbsoluteUrl} from '../utils.ts';
|
||||
import {parseIssuePageInfo, toAbsoluteUrl} from '../utils.ts';
|
||||
import {GET, POST} from '../modules/fetch.ts';
|
||||
import {showErrorToast} from '../modules/toast.ts';
|
||||
import {initRepoIssueSidebar} from './repo-issue-sidebar.ts';
|
||||
@ -57,13 +57,11 @@ function excludeLabel(item) {
|
||||
}
|
||||
|
||||
export function initRepoIssueSidebarList() {
|
||||
const repolink = $('#repolink').val();
|
||||
const repoId = $('#repoId').val();
|
||||
const issuePageInfo = parseIssuePageInfo();
|
||||
const crossRepoSearch = $('#crossRepoSearch').val();
|
||||
const tp = $('#type').val();
|
||||
let issueSearchUrl = `${appSubUrl}/${repolink}/issues/search?q={query}&type=${tp}`;
|
||||
let issueSearchUrl = `${issuePageInfo.repoLink}/issues/search?q={query}&type=${issuePageInfo.issueDependencySearchType}`;
|
||||
if (crossRepoSearch === 'true') {
|
||||
issueSearchUrl = `${appSubUrl}/issues/search?q={query}&priority_repo_id=${repoId}&type=${tp}`;
|
||||
issueSearchUrl = `${appSubUrl}/issues/search?q={query}&priority_repo_id=${issuePageInfo.repoId}&type=${issuePageInfo.issueDependencySearchType}`;
|
||||
}
|
||||
$('#new-dependency-drop-list')
|
||||
.dropdown({
|
||||
|
Reference in New Issue
Block a user