summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2024-10-17 16:03:21 +0800
committerGitHub <noreply@github.com>2024-10-17 08:03:21 +0000
commit2a99607add16cf7459429bdc4d2674b2b4ffdf8a (patch)
treeb54449ea5296fc0f95415bca72b395e7facb4464
parentc1023b97aa217cda357953d3ceb42b8cf058d904 (diff)
downloadgitea-2a99607add16cf7459429bdc4d2674b2b4ffdf8a.tar.gz
gitea-2a99607add16cf7459429bdc4d2674b2b4ffdf8a.zip
make `show stats` work when only one file changed (#32244) (#32268)
Backport #32244 fix https://github.com/go-gitea/gitea/issues/32226 in https://github.com/go-gitea/gitea/pull/27775 , it do some changes to only show diff file tree when more than one file changed. But looks it also break the `diff-file-list` logic, which looks not expected change. so try fix it. /cc @silverwind example view: ![image](https://github.com/user-attachments/assets/281e9c4f-a269-4d36-94eb-a132058aea87) Signed-off-by: a1012112796 <1012112796@qq.com>
-rw-r--r--web_src/js/features/repo-diff-filetree.js2
-rw-r--r--web_src/js/features/repo-diff.js3
2 files changed, 4 insertions, 1 deletions
diff --git a/web_src/js/features/repo-diff-filetree.js b/web_src/js/features/repo-diff-filetree.js
index 5dd2c42e74..52d7cf030d 100644
--- a/web_src/js/features/repo-diff-filetree.js
+++ b/web_src/js/features/repo-diff-filetree.js
@@ -8,7 +8,9 @@ export function initDiffFileTree() {
const fileTreeView = createApp(DiffFileTree);
fileTreeView.mount(el);
+}
+export function initDiffFileList() {
const fileListElement = document.getElementById('diff-file-list');
if (!fileListElement) return;
diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js
index 00f74515df..e7324b21b8 100644
--- a/web_src/js/features/repo-diff.js
+++ b/web_src/js/features/repo-diff.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js';
-import {initDiffFileTree} from './repo-diff-filetree.js';
+import {initDiffFileTree, initDiffFileList} from './repo-diff-filetree.js';
import {initDiffCommitSelect} from './repo-diff-commitselect.js';
import {validateTextareaNonEmpty} from './comp/ComboMarkdownEditor.js';
import {initViewedCheckboxListenerFor, countAndUpdateViewedFiles, initExpandAndCollapseFilesButton} from './pull-view-file.js';
@@ -220,6 +220,7 @@ export function initRepoDiffView() {
initRepoDiffConversationForm();
if (!$('#diff-file-list').length) return;
initDiffFileTree();
+ initDiffFileList();
initDiffCommitSelect();
initRepoDiffShowMore();
initRepoDiffReviewButton();