Browse Source

Merge pull request '调整一下更新数据集及文件列表的顺序,解决#1803' (#2602) from zouap into V20220801

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

+ 8
- 7
models/repo.go View File

@@ -1603,13 +1603,6 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
if err != nil { if err != nil {
return err return err
} }
//If repo has become private, we need set dataset and dataset_file to private
_, err = e.Where("repo_id = ? and status <> 2", repo.ID).Cols("status").Update(&Dataset{
Status: 0,
})
if err != nil {
return err
}


dataset, err := GetDatasetByRepo(repo) dataset, err := GetDatasetByRepo(repo)
if err != nil && !IsErrNotExist(err) { if err != nil && !IsErrNotExist(err) {
@@ -1624,6 +1617,14 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
} }
} }


//If repo has become private, we need set dataset and dataset_file to private
_, err = e.Where("repo_id = ? and status <> 2", repo.ID).Cols("status").Update(&Dataset{
Status: 0,
})
if err != nil {
return err
}

} else { } else {
//If repo has become public, we need set dataset to public //If repo has become public, we need set dataset to public
_, err = e.Where("repo_id = ? and status <> 2", repo.ID).Cols("status").Update(&Dataset{ _, err = e.Where("repo_id = ? and status <> 2", repo.ID).Cols("status").Update(&Dataset{


Loading…
Cancel
Save