summaryrefslogtreecommitdiffstats
path: root/models/attachment.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/attachment.go')
-rw-r--r--models/attachment.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/models/attachment.go b/models/attachment.go
index f06b389dc6..ed82aaf483 100644
--- a/models/attachment.go
+++ b/models/attachment.go
@@ -10,6 +10,7 @@ import (
"path"
"code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/modules/timeutil"
@@ -62,25 +63,25 @@ func (a *Attachment) DownloadURL() string {
}
// LinkedRepository returns the linked repo if any
-func (a *Attachment) LinkedRepository() (*Repository, UnitType, error) {
+func (a *Attachment) LinkedRepository() (*Repository, unit.Type, error) {
if a.IssueID != 0 {
iss, err := GetIssueByID(a.IssueID)
if err != nil {
- return nil, UnitTypeIssues, err
+ return nil, unit.TypeIssues, err
}
repo, err := GetRepositoryByID(iss.RepoID)
- unitType := UnitTypeIssues
+ unitType := unit.TypeIssues
if iss.IsPull {
- unitType = UnitTypePullRequests
+ unitType = unit.TypePullRequests
}
return repo, unitType, err
} else if a.ReleaseID != 0 {
rel, err := GetReleaseByID(a.ReleaseID)
if err != nil {
- return nil, UnitTypeReleases, err
+ return nil, unit.TypeReleases, err
}
repo, err := GetRepositoryByID(rel.RepoID)
- return repo, UnitTypeReleases, err
+ return repo, unit.TypeReleases, err
}
return nil, -1, nil
}