aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2019-12-11 01:01:52 +0100
committerzeripath <art27@cantab.net>2019-12-11 00:01:52 +0000
commitc3d31e55346329a221cc0ae37d89d1fba11ea737 (patch)
tree61914ec27d02be2351a1951ada1526e9beb455db /models/issue_comment.go
parent50da9f7daed4fe3e8f0c76f23eeb987e97de4962 (diff)
downloadgitea-c3d31e55346329a221cc0ae37d89d1fba11ea737.tar.gz
gitea-c3d31e55346329a221cc0ae37d89d1fba11ea737.zip
refactor(models/attachement): use getAttachmentsByUUIDs (#9317)
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 5843689f1b..c68df028e0 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -567,16 +567,9 @@ func updateCommentInfos(e *xorm.Session, opts *CreateCommentOptions, comment *Co
}
// Check attachments
- attachments := make([]*Attachment, 0, len(opts.Attachments))
- for _, uuid := range opts.Attachments {
- attach, err := getAttachmentByUUID(e, uuid)
- if err != nil {
- if IsErrAttachmentNotExist(err) {
- continue
- }
- return fmt.Errorf("getAttachmentByUUID [%s]: %v", uuid, err)
- }
- attachments = append(attachments, attach)
+ attachments, err := getAttachmentsByUUIDs(e, opts.Attachments)
+ if err != nil {
+ return fmt.Errorf("getAttachmentsByUUIDs [uuids: %v]: %v", opts.Attachments, err)
}
for i := range attachments {