diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-20 14:39:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 02:39:44 -0400 |
commit | de2268ffab922de67f51e98541d0f9078795ac5d (patch) | |
tree | a9f79d0bcb2914d64ce1399a025fb01e887cc7eb /services | |
parent | 92e07f270aa925d518b13686f78befb63da0a747 (diff) | |
download | gitea-de2268ffab922de67f51e98541d0f9078795ac5d.tar.gz gitea-de2268ffab922de67f51e98541d0f9078795ac5d.zip |
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 <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'services')
-rw-r--r-- | services/issue/comments.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/services/issue/comments.go b/services/issue/comments.go index 4fe07c17b9..4a181499bc 100644 --- a/services/issue/comments.go +++ b/services/issue/comments.go @@ -90,8 +90,7 @@ func CreateIssueComment(ctx context.Context, doer *user_model.User, repo *repo_m // UpdateComment updates information of comment. func UpdateComment(ctx context.Context, c *issues_model.Comment, doer *user_model.User, oldContent string) error { - needsContentHistory := c.Content != oldContent && - (c.Type == issues_model.CommentTypeComment || c.Type == issues_model.CommentTypeReview || c.Type == issues_model.CommentTypeCode) + needsContentHistory := c.Content != oldContent && c.Type.HasContentSupport() if needsContentHistory { hasContentHistory, err := issues_model.HasIssueContentHistory(ctx, c.IssueID, c.ID) if err != nil { |