From a467184e13e4e3867031c191263dc0adaec2673c Mon Sep 17 00:00:00 2001 From: Download-Fritz Date: Fri, 19 Feb 2016 20:33:06 +0100 Subject: #2505 Allow to fork and disallow to create PRs for mirrors. --- models/repo.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'models') 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 { -- cgit v1.2.3