From de2268ffab922de67f51e98541d0f9078795ac5d Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 20 Apr 2023 14:39:44 +0800 Subject: Fix issue attachment handling (#24202) Close #24195 Some of the changes are taken from my another fix https://github.com/go-gitea/gitea/pull/20147/commits/f07b0de997125c9b79cc5af27966a7cdd1803a4d in #20147 (although that PR was discarded ....) The bug is: 1. The old code doesn't handle `removedfile` event correctly 2. The old code doesn't provide attachments for type=CommentTypeReview This PR doesn't intend to refactor the "upload" code to a perfect state (to avoid making the review difficult), so some legacy styles are kept. --------- Co-authored-by: silverwind Co-authored-by: Giteabot --- templates/repo/diff/comments.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 20 +++++++++++--------- templates/repo/issue/view_content/attachments.tmpl | 20 ++++++++++---------- templates/repo/issue/view_content/comments.tmpl | 6 +++--- 4 files changed, 25 insertions(+), 23 deletions(-) (limited to 'templates') diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 5bcaeeb463..f301261533 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -55,7 +55,7 @@ {{end}}
{{.Content}}
-
+
{{$reactions := .Reactions.GroupByType}} {{if $reactions}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index a5d9b0bde0..081b7d08c6 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -78,7 +78,7 @@ {{end}}
{{.Issue.Content}}
-
+
{{if .Issue.Attachments}} {{template "repo/issue/view_content/attachments" dict "ctxData" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}} {{end}} @@ -166,13 +166,15 @@