aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2021-11-22 13:20:16 +0100
committerGitHub <noreply@github.com>2021-11-22 20:20:16 +0800
commita3efd048a7770aff898096df55eda76e80a4972e (patch)
treeaea86e365fed219016a2d2e106572fde6a5b7e84 /web_src/js/features
parent49b2cb998b6ebaf98e89dd9dba8ba9d46d2fd82c (diff)
downloadgitea-a3efd048a7770aff898096df55eda76e80a4972e.tar.gz
gitea-a3efd048a7770aff898096df55eda76e80a4972e.zip
Improvements to content history (#17746)
* Improvements to content history * initialize content history when making an edit to an old item created before the introduction of content history * show edit history for code comments on pull request files tab * Fix a flaw in keepLimitedContentHistory Fix a flaw in keepLimitedContentHistory, the first and the last should never be deleted * Remove obsolete eager initialization of content history
Diffstat (limited to 'web_src/js/features')
-rw-r--r--web_src/js/features/repo-issue-content.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/web_src/js/features/repo-issue-content.js b/web_src/js/features/repo-issue-content.js
index a2fc6c3cbe..602523f89d 100644
--- a/web_src/js/features/repo-issue-content.js
+++ b/web_src/js/features/repo-issue-content.js
@@ -106,8 +106,11 @@ function showContentHistoryMenu(issueBaseUrl, $item, commentId) {
export function initRepoIssueContentHistory() {
const issueIndex = $('#issueIndex').val();
- const $itemIssue = $('.timeline-item.comment.first');
- if (!issueIndex || !$itemIssue.length) return;
+ if (!issueIndex) return;
+
+ const $itemIssue = $('.repository.issue .timeline-item.comment.first'); // issue(PR) main content
+ const $comments = $('.repository.issue .comment-list .comment'); // includes: issue(PR) comments, code rerview comments
+ if (!$itemIssue.length && !$comments.length) return;
const repoLink = $('#repolink').val();
const issueBaseUrl = `${appSubUrl}/${repoLink}/issues/${issueIndex}`;
@@ -123,7 +126,7 @@ export function initRepoIssueContentHistory() {
i18nTextDeleteFromHistoryConfirm = resp.i18n.textDeleteFromHistoryConfirm;
i18nTextOptions = resp.i18n.textOptions;
- if (resp.editedHistoryCountMap[0]) {
+ if (resp.editedHistoryCountMap[0] && $itemIssue.length) {
showContentHistoryMenu(issueBaseUrl, $itemIssue, '0');
}
for (const [commentId, _editedCount] of Object.entries(resp.editedHistoryCountMap)) {