Просмотр исходного кода

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

* Make pull attachments depend on read UnitTypePullRequests

Fixes #10336

* Fix test
tags/v1.10.5
zeripath 4 лет назад
Родитель
Сommit
41294b53b3
Аккаунт пользователя с таким Email не найден
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},
}

Загрузка…
Отмена
Сохранить