Browse Source

Merge pull request '修改项目不能改为私有的问题' (#1815) from V20220328.patch into V20220415

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1815
Reviewed-by: lewis <747342561@qq.com>
tags/v1.22.4.1^2
lewis 3 years ago
parent
commit
11a00c5076
2 changed files with 9 additions and 7 deletions
  1. +1
    -1
      models/dataset.go
  2. +8
    -6
      models/repo.go

+ 1
- 1
models/dataset.go View File

@@ -348,7 +348,7 @@ func GetDatasetByRepo(repo *Repository) (*Dataset, error) {
if has {
return dataset, nil
} else {
return nil, errors.New("Not Found")
return nil, ErrNotExist{repo.ID}
}
}



+ 8
- 6
models/repo.go View File

@@ -1607,14 +1607,16 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
}

dataset, err := GetDatasetByRepo(repo)
if err != nil {
if err != nil && !IsErrNotExist(err) {
return err
}
_, err = e.Where("dataset_id = ?", dataset.ID).Cols("is_private").Update(&Attachment{
IsPrivate: true,
})
if err != nil {
return err
if dataset != nil {
_, err = e.Where("dataset_id = ?", dataset.ID).Cols("is_private").Update(&Attachment{
IsPrivate: true,
})
if err != nil {
return err
}
}

} else {


Loading…
Cancel
Save