diff --git a/gogs.go b/gogs.go index a8386ab5c..fddb1f60a 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogs/gogs/pkg/setting" ) -const APP_VER = "0.11.60.0814" +const APP_VER = "0.11.61.0816" func init() { setting.AppVer = APP_VER diff --git a/models/attachment.go b/models/attachment.go index 31ca7f3e8..e053ebff5 100644 --- a/models/attachment.go +++ b/models/attachment.go @@ -165,7 +165,6 @@ func DeleteAttachments(attachments []*Attachment, remove bool) (int, error) { // DeleteAttachmentsByIssue deletes all attachments associated with the given issue. func DeleteAttachmentsByIssue(issueId int64, remove bool) (int, error) { attachments, err := GetAttachmentsByIssueID(issueId) - if err != nil { return 0, err } @@ -176,7 +175,6 @@ func DeleteAttachmentsByIssue(issueId int64, remove bool) (int, error) { // DeleteAttachmentsByComment deletes all attachments associated with the given comment. func DeleteAttachmentsByComment(commentId int64, remove bool) (int, error) { attachments, err := GetAttachmentsByCommentID(commentId) - if err != nil { return 0, err } diff --git a/models/comment.go b/models/comment.go index 447c15db9..66531bbb3 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 { diff --git a/templates/.VERSION b/templates/.VERSION index 941680718..d04c7a441 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.60.0814 +0.11.61.0816