From 55a0de34c9557bfb55105a1921b913ffdf26a9fb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 13 2016 09:10:08 +0000 Subject: [PATCH 1/3] Hide the buttons to create pull-request when these are deactivated Projects can turn off pull-requests, so there is then no point in showing the pull-request buttons at all --- diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index cacfc24..203d14f 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -34,7 +34,7 @@ git push -u origin master {% else %} {% if origin == 'view_commits' %} - {% if diff_commits and authenticated %} + {% if diff_commits and authenticated and repo.settings.get('pull_requests', True) %} From cb1cf8d4de2e46d11e9e8018e97c2283716f645b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 13 2016 09:10:08 +0000 Subject: [PATCH 2/3] Fix the error message returned for forbidden remote PR Projects can disable pull-request, so we do not allow creating remote PR and that's what the error message should say --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 5e043e0..6900249 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -989,7 +989,7 @@ def new_remote_request_pull(repo, username=None): flask.abort(404) if not repo.settings.get('pull_requests', True): - flask.abort(404, 'No pull-requests found for this project') + flask.abort(404, 'No pull-request allowed on this project') parentpath = pagure.get_repo_path(repo) orig_repo = pygit2.Repository(parentpath) From fdd6b045c43ce9764827651500a6b08af80a5d51 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 13 2016 09:10:08 +0000 Subject: [PATCH 3/3] Fix the error message returned when trying to create a local PR while not allowed --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 6900249..121f931 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -878,7 +878,7 @@ def new_request_pull(repo, branch_to, branch_from, username=None): parent = repo.parent if not parent.settings.get('pull_requests', True): - flask.abort(404, 'No pull-requests found for this project') + flask.abort(404, 'No pull-request allowed on this project') repopath = pagure.get_repo_path(repo) repo_obj = pygit2.Repository(repopath)