summaryrefslogtreecommitdiffstats
path: root/models/release.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/release.go')
-rw-r--r--models/release.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/models/release.go b/models/release.go
index b7ec4461f2..28a2891013 100644
--- a/models/release.go
+++ b/models/release.go
@@ -50,12 +50,12 @@ func (r *Release) loadAttributes(e Engine) error {
}
}
if r.Publisher == nil {
- r.Publisher, err = GetUserByID(r.PublisherID)
+ r.Publisher, err = getUserByID(e, r.PublisherID)
if err != nil {
return err
}
}
- return GetReleaseAttachments(r)
+ return getReleaseAttachments(e, r)
}
// LoadAttributes load repo and publisher attributes for a release
@@ -316,6 +316,10 @@ func (s releaseMetaSearch) Less(i, j int) bool {
// GetReleaseAttachments retrieves the attachments for releases
func GetReleaseAttachments(rels ...*Release) (err error) {
+ return getReleaseAttachments(x, rels...)
+}
+
+func getReleaseAttachments(e Engine, rels ...*Release) (err error) {
if len(rels) == 0 {
return
}
@@ -335,11 +339,10 @@ func GetReleaseAttachments(rels ...*Release) (err error) {
sort.Sort(sortedRels)
// Select attachments
- err = x.
+ err = e.
Asc("release_id").
In("release_id", sortedRels.ID).
Find(&attachments, Attachment{})
-
if err != nil {
return err
}
@@ -354,7 +357,6 @@ func GetReleaseAttachments(rels ...*Release) (err error) {
}
return
-
}
type releaseSorter struct {
@@ -493,7 +495,7 @@ func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error {
return fmt.Errorf("GetTagCommitID: %v", err)
}
if git.IsErrNotExist(err) || commitID != rel.Sha1 {
- if err := pushUpdateDeleteTag(repo, gitRepo, rel.TagName); err != nil {
+ if err := pushUpdateDeleteTag(repo, rel.TagName); err != nil {
return fmt.Errorf("pushUpdateDeleteTag: %v", err)
}
} else {