diff options
author | Morgan Bazalgette <git@howl.moe> | 2017-02-11 11:57:57 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-11 18:57:57 +0800 |
commit | 442145dbd348a18915de80faea68f30a9d9309b3 (patch) | |
tree | 4d1306edbfa72064ec006b73afd6d2150e507da6 /models/repo.go | |
parent | a36a8f4d72bd8d5161f29c2df177ae5a73fe882c (diff) | |
download | gitea-442145dbd348a18915de80faea68f30a9d9309b3.tar.gz gitea-442145dbd348a18915de80faea68f30a9d9309b3.zip |
Fix public activity showing private repos (#892)
* Fix public activity showing private repos (#811)
Signed-off-by: Morgan Bazalgette <the@howl.moe>
* error check after setting is_private to true
* Add test for UpdateRepository w/ visibility change
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index a7a36cc7d0..86961d68d7 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1408,6 +1408,16 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e } } + // If repo has become private, we need to set its actions to private. + if repo.IsPrivate { + _, err = e.Where("repo_id = ?", repo.ID).Cols("is_private").Update(&Action{ + IsPrivate: true, + }) + if err != nil { + return err + } + } + // Create/Remove git-daemon-export-ok for git-daemon... daemonExportFile := path.Join(repo.RepoPath(), `git-daemon-export-ok`) if repo.IsPrivate && com.IsExist(daemonExportFile) { |