diff options
Diffstat (limited to 'models/comment.go')
-rw-r--r-- | models/comment.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/models/comment.go b/models/comment.go index 447c15db..66531bbb 100644 --- a/models/comment.go +++ b/models/comment.go @@ -132,14 +132,6 @@ func (c *Comment) LoadAttributes() error { return c.loadAttributes(x) } -func (c *Comment) AfterDelete() { - _, err := DeleteAttachmentsByComment(c.ID, true) - - if err != nil { - log.Info("Could not delete files for comment %d on issue #%d: %s", c.ID, c.IssueID, err) - } -} - func (c *Comment) HTMLURL() string { return fmt.Sprintf("%s#issuecomment-%d", c.Issue.HTMLURL(), c.ID) } @@ -519,7 +511,12 @@ func DeleteCommentByID(doer *User, id int64) error { } if err = sess.Commit(); err != nil { - return fmt.Errorf("Commit: %v", err) + return fmt.Errorf("commit: %v", err) + } + + _, err = DeleteAttachmentsByComment(comment.ID, true) + if err != nil { + log.Error(2, "Failed to delete attachments by comment[%d]: %v", comment.ID, err) } if err = comment.Issue.LoadAttributes(); err != nil { |