diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-10 03:57:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 20:57:58 +0100 |
commit | 99b2858e628d92bba252be72def409af77af735b (patch) | |
tree | 56159cf10b271307911e6f01626c0c3efba789ab /models/attachment.go | |
parent | b6b1e716654fec3b16d245ef65cf42e57e1bb5b6 (diff) | |
download | gitea-99b2858e628d92bba252be72def409af77af735b.tar.gz gitea-99b2858e628d92bba252be72def409af77af735b.zip |
Move unit into models/unit/ (#17576)
* Move unit into models/unit/
* Rename unit.UnitType as unit.Type
Diffstat (limited to 'models/attachment.go')
-rw-r--r-- | models/attachment.go | 13 |
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 } |