Skip to content

Commit 026b762

Browse files
committed
fix test
1 parent a1e210b commit 026b762

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

services/attachment/attachment_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ func TestUploadAttachment(t *testing.T) {
4747

4848
func TestDeleteAttachments(t *testing.T) {
4949
assert.NoError(t, unittest.PrepareTestDatabase())
50+
attachment8 := unittest.AssertExistsAndLoadBean(t, &repo_model.Attachment{ID: 8})
5051

51-
err := DeleteAttachment(db.DefaultContext, &repo_model.Attachment{ID: 8})
52+
err := DeleteAttachment(db.DefaultContext, attachment8)
5253
assert.NoError(t, err)
5354

5455
attachment, err := repo_model.GetAttachmentByUUID(db.DefaultContext, "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18")

services/issue/comments.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func deleteComment(ctx context.Context, comment *issues_model.Comment, removeAtt
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, false)
185+
deletedReviewComment, cleanup, err := deleteComment(ctx, comment, true)
186186
if err != nil {
187187
return nil, err
188188
}

services/issue/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func deleteIssue(ctx context.Context, issue *issues_model.Issue, deleteAttachmen
325325

326326
if deleteAttachments {
327327
// delete issue attachments
328-
_, err := db.GetEngine(ctx).Where("issue_id = ? AND comment_id = 0", issue.ID).NoAutoCondition().Delete(&issues_model.Issue{})
328+
_, err := db.GetEngine(ctx).Where("issue_id = ? AND comment_id = 0", issue.ID).NoAutoCondition().Delete(&repo_model.Attachment{})
329329
if err != nil {
330330
return err
331331
}

0 commit comments

Comments
 (0)