瀏覽代碼

Reading pull attachments should depend on read UnitTypePullRequests (#10346) (#10354)

Co-authored-by: zeripath <art27@cantab.net>
tags/v1.11.2
guillep2k 4 年之前
父節點
當前提交
14bd120cdc
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 6 行新增2 行删除
  1. 5
    1
      models/attachment.go
  2. 1
    1
      models/attachment_test.go

+ 5
- 1
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 {

+ 1
- 1
models/attachment_test.go 查看文件

@@ -138,7 +138,7 @@ func TestLinkedRepository(t *testing.T) {
expectedUnitType UnitType
}{
{"LinkedIssue", 1, &Repository{ID: 1}, UnitTypeIssues},
{"LinkedComment", 3, &Repository{ID: 1}, UnitTypeIssues},
{"LinkedComment", 3, &Repository{ID: 1}, UnitTypePullRequests},
{"LinkedRelease", 9, &Repository{ID: 1}, UnitTypeReleases},
{"Notlinked", 10, nil, -1},
}

Loading…
取消
儲存