Skip to content

Commit 14bd120

Browse files
guillep2kzeripath
andauthored
Reading pull attachments should depend on read UnitTypePullRequests (#10346) (#10354)
Co-authored-by: zeripath <[email protected]>
1 parent 3e40f8b commit 14bd120

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

models/attachment.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ func (a *Attachment) LinkedRepository() (*Repository, UnitType, error) {
7979
return nil, UnitTypeIssues, err
8080
}
8181
repo, err := GetRepositoryByID(iss.RepoID)
82-
return repo, UnitTypeIssues, err
82+
unitType := UnitTypeIssues
83+
if iss.IsPull {
84+
unitType = UnitTypePullRequests
85+
}
86+
return repo, unitType, err
8387
} else if a.ReleaseID != 0 {
8488
rel, err := GetReleaseByID(a.ReleaseID)
8589
if err != nil {

models/attachment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func TestLinkedRepository(t *testing.T) {
138138
expectedUnitType UnitType
139139
}{
140140
{"LinkedIssue", 1, &Repository{ID: 1}, UnitTypeIssues},
141-
{"LinkedComment", 3, &Repository{ID: 1}, UnitTypeIssues},
141+
{"LinkedComment", 3, &Repository{ID: 1}, UnitTypePullRequests},
142142
{"LinkedRelease", 9, &Repository{ID: 1}, UnitTypeReleases},
143143
{"Notlinked", 10, nil, -1},
144144
}

0 commit comments

Comments
 (0)