diff options
Diffstat (limited to 'services/release/release.go')
-rw-r--r-- | services/release/release.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/services/release/release.go b/services/release/release.go index f6f456e8fa..30274f93ef 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" + repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification" @@ -206,7 +207,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea var deletedUUIDsMap = make(map[string]bool) if len(delAttachmentUUIDs) > 0 { // Check attachments - attachments, err := models.GetAttachmentsByUUIDs(ctx, delAttachmentUUIDs) + attachments, err := repo_model.GetAttachmentsByUUIDs(ctx, delAttachmentUUIDs) if err != nil { return fmt.Errorf("GetAttachmentsByUUIDs [uuids: %v]: %v", delAttachmentUUIDs, err) } @@ -217,7 +218,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea deletedUUIDsMap[attach.UUID] = true } - if _, err := models.DeleteAttachments(ctx, attachments, false); err != nil { + if _, err := repo_model.DeleteAttachments(ctx, attachments, false); err != nil { return fmt.Errorf("DeleteAttachments [uuids: %v]: %v", delAttachmentUUIDs, err) } } @@ -228,7 +229,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea updateAttachmentsList = append(updateAttachmentsList, k) } // Check attachments - attachments, err := models.GetAttachmentsByUUIDs(ctx, updateAttachmentsList) + attachments, err := repo_model.GetAttachmentsByUUIDs(ctx, updateAttachmentsList) if err != nil { return fmt.Errorf("GetAttachmentsByUUIDs [uuids: %v]: %v", updateAttachmentsList, err) } @@ -240,7 +241,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea for uuid, newName := range editAttachments { if !deletedUUIDsMap[uuid] { - if err = models.UpdateAttachmentByUUID(ctx, &models.Attachment{ + if err = repo_model.UpdateAttachmentByUUID(ctx, &repo_model.Attachment{ UUID: uuid, Name: newName, }, "name"); err != nil { @@ -255,7 +256,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea } for _, uuid := range delAttachmentUUIDs { - if err := storage.Attachments.Delete(models.AttachmentRelativePath(uuid)); err != nil { + if err := storage.Attachments.Delete(repo_model.AttachmentRelativePath(uuid)); err != nil { // Even delete files failed, but the attachments has been removed from database, so we // should not return error but only record the error on logs. // users have to delete this attachments manually or we should have a @@ -321,7 +322,7 @@ func DeleteReleaseByID(id int64, doer *models.User, delTag bool) error { return fmt.Errorf("LoadAttributes: %v", err) } - if err := models.DeleteAttachmentsByRelease(rel.ID); err != nil { + if err := repo_model.DeleteAttachmentsByRelease(rel.ID); err != nil { return fmt.Errorf("DeleteAttachments: %v", err) } |