Skip to content

Commit 4ae54c8

Browse files
committed
Rename
1 parent 8440344 commit 4ae54c8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

services/issue/comments.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ func UpdateComment(ctx context.Context, c *issues_model.Comment, contentVersion
135135
}
136136

137137
// deleteComment deletes the comment
138-
func deleteComment(ctx context.Context, comment *issues_model.Comment, removeAttachments bool) (*issues_model.Comment, func(), error) {
139-
storageCleanup := util.NewPostTxAction()
138+
func deleteComment(ctx context.Context, comment *issues_model.Comment, removeAttachments bool) (*issues_model.Comment, util.PostTxAction, error) {
139+
postTxActions := util.NewPostTxAction()
140140
deletedReviewComment, err := db.WithTx2(ctx, func(ctx context.Context) (*issues_model.Comment, error) {
141141
if removeAttachments {
142142
// load attachments before deleting the comment
@@ -157,7 +157,7 @@ func deleteComment(ctx context.Context, comment *issues_model.Comment, removeAtt
157157
}
158158

159159
// the storage cleanup function to remove attachments could be called after all transactions are committed
160-
storageCleanup = storageCleanup.Append(func() {
160+
postTxActions = postTxActions.Append(func() {
161161
for _, a := range comment.Attachments {
162162
if err := storage.Attachments.Delete(a.RelativePath()); err != nil {
163163
if !errors.Is(err, os.ErrNotExist) {
@@ -178,15 +178,15 @@ func deleteComment(ctx context.Context, comment *issues_model.Comment, removeAtt
178178
if err != nil {
179179
return nil, nil, err
180180
}
181-
return deletedReviewComment, storageCleanup, nil
181+
return deletedReviewComment, postTxActions, nil
182182
}
183183

184184
func DeleteComment(ctx context.Context, doer *user_model.User, comment *issues_model.Comment) (*issues_model.Comment, error) {
185-
deletedReviewComment, cleanup, err := deleteComment(ctx, comment, true)
185+
deletedReviewComment, postTxActions, err := deleteComment(ctx, comment, true)
186186
if err != nil {
187187
return nil, err
188188
}
189-
cleanup()
189+
postTxActions()
190190

191191
notify_service.DeleteComment(ctx, doer, comment)
192192

0 commit comments

Comments
 (0)