diff options
author | Download-Fritz <download-fritz@outlook.com> | 2016-02-19 20:33:06 +0100 |
---|---|---|
committer | Download-Fritz <download-fritz@outlook.com> | 2016-02-19 20:33:06 +0100 |
commit | a467184e13e4e3867031c191263dc0adaec2673c (patch) | |
tree | e01e62d7085e72e4a8f02142c1a5fe3571e56c4d /models | |
parent | 2fdf8fc938295b95cbe6efb7cddb1b87c2fb81ee (diff) |
#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 57014beb..98bb1107 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 { |