diff options
author | Justin Nuß <justin.nuss@hmmh.de> | 2014-07-24 09:04:09 +0200 |
---|---|---|
committer | Justin Nuß <justin.nuss@hmmh.de> | 2014-07-24 09:05:15 +0200 |
commit | 3c025b395077292a721419942f997311ef575fd9 (patch) | |
tree | c50491826df2c9f98fd8489e9352d44e544ff92f /models | |
parent | 34304e6a0c9a3904b999e3ae1fcc9e6518d3f026 (diff) | |
download | gitea-3c025b395077292a721419942f997311ef575fd9.tar.gz gitea-3c025b395077292a721419942f997311ef575fd9.zip |
Add delete route for attachments, remove upload buttons from issues/comments
Diffstat (limited to 'models')
-rw-r--r-- | models/issue.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go index c0f2da2f2b..43575a07c9 100644 --- a/models/issue.go +++ b/models/issue.go @@ -868,6 +868,14 @@ func CreateComment(userId, repoId, issueId, commitId, line int64, cmtType int, c return comment, sess.Commit() } +// GetCommentById returns the comment with the given id +func GetCommentById(commentId int64) (*Comment, error) { + c := &Comment{Id: commentId} + _, err := x.Get(c) + + return c, err +} + // GetIssueComments returns list of comment by given issue id. func GetIssueComments(issueId int64) ([]Comment, error) { comments := make([]Comment, 0, 10) @@ -936,14 +944,14 @@ func GetAttachmentById(id int64) (*Attachment, error) { func GetAttachmentsForIssue(issueId int64) ([]*Attachment, error) { attachments := make([]*Attachment, 0, 10) - err := x.Where("issue_id = ?", issueId).Where("comment_id = 0").Find(&attachments) + err := x.Where("issue_id = ?", issueId).And("comment_id = 0").Find(&attachments) return attachments, err } // GetAttachmentsByIssue returns a list of attachments for the given issue func GetAttachmentsByIssue(issueId int64) ([]*Attachment, error) { attachments := make([]*Attachment, 0, 10) - err := x.Where("issue_id = ?", issueId).Where("comment_id > 0").Find(&attachments) + err := x.Where("issue_id = ?", issueId).And("comment_id > 0").Find(&attachments) return attachments, err } |