diff options
author | Unknwon <u@gogs.io> | 2016-02-19 15:04:50 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-19 15:04:50 -0500 |
commit | 2408df3f3549bdddb16c7ce01e9cf5a2e18c0df5 (patch) | |
tree | a86642f774a8bd6a30ebc0b85575d2c1594c83b7 /models | |
parent | 736a46dff96430f4ee43e6a2eb1bccbccaa611d4 (diff) | |
parent | a1b28fc33c4a685ffe9a07f67fa6786ec27524bb (diff) | |
download | gitea-2408df3f3549bdddb16c7ce01e9cf5a2e18c0df5.tar.gz gitea-2408df3f3549bdddb16c7ce01e9cf5a2e18c0df5.zip |
Merge pull request #2663 from Download-Fritz/MirrorForks
#2505 Allow to fork and disallow to create PRs for mirrors.
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/models/repo.go b/models/repo.go index 57014beb0a..98bb1107b3 100644 --- a/models/repo.go +++ b/models/repo.go @@ -332,7 +332,17 @@ func (repo *Repository) IsOwnedBy(userID int64) bool { // CanBeForked returns true if repository meets the requirements of being forked. func (repo *Repository) CanBeForked() bool { - return !repo.IsBare && !repo.IsMirror + return !repo.IsBare +} + +// CanEnablePulls returns true if repository meets the requirements of accepting pulls. +func (repo *Repository) CanEnablePulls() bool { + return !repo.IsMirror +} + +// AllowPulls returns true if repository meets the requirements of accepting pulls and has them enabled. +func (repo *Repository) AllowsPulls() bool { + return repo.CanEnablePulls() && repo.EnablePulls; } func (repo *Repository) NextIssueIndex() int64 { |