aboutsummaryrefslogtreecommitdiffstats
path: root/models/attachment.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-02-19 00:36:19 +0000
committerGitHub <noreply@github.com>2020-02-18 21:36:19 -0300
commit41294b53b3ca4b478b74e05e7d012899bf51e19f (patch)
tree13b87bf7ba699136984a6d7e15a67753c9929bdd /models/attachment.go
parent9f1f2e66757d49a7e7096501514bd90a53190ec0 (diff)
downloadgitea-41294b53b3ca4b478b74e05e7d012899bf51e19f.tar.gz
gitea-41294b53b3ca4b478b74e05e7d012899bf51e19f.zip
Reading pull attachments should depend on read UnitTypePullRequests (#10346)
* Make pull attachments depend on read UnitTypePullRequests Fixes #10336 * Fix test
Diffstat (limited to 'models/attachment.go')
-rw-r--r--models/attachment.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/models/attachment.go b/models/attachment.go
index 6cfa6cb64e..81f2e15dad 100644
--- a/models/attachment.go
+++ b/models/attachment.go
@@ -79,7 +79,11 @@ func (a *Attachment) LinkedRepository() (*Repository, UnitType, error) {
return nil, UnitTypeIssues, err
}
repo, err := GetRepositoryByID(iss.RepoID)
- return repo, UnitTypeIssues, err
+ unitType := UnitTypeIssues
+ if iss.IsPull {
+ unitType = UnitTypePullRequests
+ }
+ return repo, unitType, err
} else if a.ReleaseID != 0 {
rel, err := GetReleaseByID(a.ReleaseID)
if err != nil {