@@ -17,7 +17,6 @@ import (
17
17
"code.gitea.io/gitea/modules/gitrepo"
18
18
"code.gitea.io/gitea/modules/json"
19
19
"code.gitea.io/gitea/modules/log"
20
- "code.gitea.io/gitea/modules/storage"
21
20
"code.gitea.io/gitea/modules/timeutil"
22
21
git_service "code.gitea.io/gitea/services/git"
23
22
notify_service "code.gitea.io/gitea/services/notify"
@@ -136,19 +135,10 @@ func UpdateComment(ctx context.Context, c *issues_model.Comment, contentVersion
136
135
// DeleteComment deletes the comment
137
136
func DeleteComment (ctx context.Context , doer * user_model.User , comment * issues_model.Comment ) error {
138
137
err := db .WithTx (ctx , func (ctx context.Context ) error {
139
- if err := comment .LoadAttachments (ctx ); err != nil {
140
- return err
141
- }
142
-
143
138
if err := issues_model .DeleteComment (ctx , comment ); err != nil {
144
139
return err
145
140
}
146
141
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
-
152
142
if comment .ReviewID > 0 {
153
143
if err := comment .LoadIssue (ctx ); err != nil {
154
144
return err
@@ -167,15 +157,6 @@ func DeleteComment(ctx context.Context, doer *user_model.User, comment *issues_m
167
157
}
168
158
}
169
159
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
- }
179
160
return nil
180
161
})
181
162
if err != nil {
0 commit comments