aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-01-24 21:43:02 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2017-01-25 10:43:02 +0800
commit833f8b94c2cd88277eba32984594aad2b7b2b05d (patch)
treead197af65043b654f0c64702db707b9335568bd7 /models/issue_comment.go
parent8bc431952f4ae76559054c3a9f41804b145d9230 (diff)
downloadgitea-833f8b94c2cd88277eba32984594aad2b7b2b05d.tar.gz
gitea-833f8b94c2cd88277eba32984594aad2b7b2b05d.zip
Search bar for issues/pulls (#530)
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go18
1 files changed, 5 insertions, 13 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index e9a401b864..a17be97e72 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -454,28 +454,20 @@ func UpdateComment(c *Comment) error {
return err
}
-// DeleteCommentByID deletes the comment by given ID.
-func DeleteCommentByID(id int64) error {
- comment, err := GetCommentByID(id)
- if err != nil {
- if IsErrCommentNotExist(err) {
- return nil
- }
- return err
- }
-
+// DeleteComment deletes the comment
+func DeleteComment(comment *Comment) error {
sess := x.NewSession()
defer sessionRelease(sess)
- if err = sess.Begin(); err != nil {
+ if err := sess.Begin(); err != nil {
return err
}
- if _, err = sess.Id(comment.ID).Delete(new(Comment)); err != nil {
+ if _, err := sess.Id(comment.ID).Delete(new(Comment)); err != nil {
return err
}
if comment.Type == CommentTypeComment {
- if _, err = sess.Exec("UPDATE `issue` SET num_comments = num_comments - 1 WHERE id = ?", comment.IssueID); err != nil {
+ if _, err := sess.Exec("UPDATE `issue` SET num_comments = num_comments - 1 WHERE id = ?", comment.IssueID); err != nil {
return err
}
}