@@ -17,7 +17,6 @@ import (
1717 "code.gitea.io/gitea/modules/gitrepo"
1818 "code.gitea.io/gitea/modules/json"
1919 "code.gitea.io/gitea/modules/log"
20- "code.gitea.io/gitea/modules/storage"
2120 "code.gitea.io/gitea/modules/timeutil"
2221 git_service "code.gitea.io/gitea/services/git"
2322 notify_service "code.gitea.io/gitea/services/notify"
@@ -136,19 +135,10 @@ func UpdateComment(ctx context.Context, c *issues_model.Comment, contentVersion
136135// DeleteComment deletes the comment
137136func DeleteComment (ctx context.Context , doer * user_model.User , comment * issues_model.Comment ) error {
138137 err := db .WithTx (ctx , func (ctx context.Context ) error {
139- if err := comment .LoadAttachments (ctx ); err != nil {
140- return err
141- }
142-
143138 if err := issues_model .DeleteComment (ctx , comment ); err != nil {
144139 return err
145140 }
146141
147- // delete comment attachments
148- if _ , err := repo_model .DeleteAttachments (ctx , comment .Attachments , true ); err != nil {
149- return fmt .Errorf ("delete attachments: %w" , err )
150- }
151-
152142 if comment .ReviewID > 0 {
153143 if err := comment .LoadIssue (ctx ); err != nil {
154144 return err
@@ -167,15 +157,6 @@ func DeleteComment(ctx context.Context, doer *user_model.User, comment *issues_m
167157 }
168158 }
169159
170- for _ , attachment := range comment .Attachments {
171- if err := storage .Attachments .Delete (repo_model .AttachmentRelativePath (attachment .UUID )); err != nil {
172- // Even delete files failed, but the attachments has been removed from database, so we
173- // should not return error but only record the error on logs.
174- // users have to delete this attachments manually or we should have a
175- // synchronize between database attachment table and attachment storage
176- log .Error ("delete attachment[uuid: %s] failed: %v" , attachment .UUID , err )
177- }
178- }
179160 return nil
180161 })
181162 if err != nil {
0 commit comments