diff --git a/pagure/templates/repo_pull_request.html b/pagure/templates/repo_pull_request.html index a8c1491..ae6a174 100644 --- a/pagure/templates/repo_pull_request.html +++ b/pagure/templates/repo_pull_request.html @@ -84,7 +84,7 @@
- {% if pull_request.remote_git or pull_request.project_from.is_fork %} + {% if pull_request.remote_git or (pull_request.project_from and pull_request.project_from.is_fork) %} {% if pull_request.remote_git %} @@ -99,8 +99,7 @@ {%- endif -%} {{pull_request.project_from.name}} {% endif %} - - {% endif %} + {{ pull_request.branch_from }} - + + {% else %} + + + Unknown source + + {% endif %}  into  {% for commit in diff_commits %} - {% if pull_request.status and pull_request.project_from.is_fork %} + {% if pull_request.status and (pull_request.project_from and pull_request.project_from.is_fork) %} {% set commit_link = url_for( 'ui_ns.view_commit', repo=pull_request.project_from.name, diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 18e68df..880fbd6 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -331,6 +331,7 @@ def request_pull(repo, requestid, username=None, namespace=None): can_delete_branch = ( pagure_config.get("ALLOW_DELETE_BRANCH", True) and not request.remote_git + and request.project_from and pagure.utils.is_repo_committer(request.project_from) ) return flask.render_template( diff --git a/tests/test_pagure_merge_pr_no_fork.py b/tests/test_pagure_merge_pr_no_fork.py index a608bb9..3a08065 100644 --- a/tests/test_pagure_merge_pr_no_fork.py +++ b/tests/test_pagure_merge_pr_no_fork.py @@ -205,7 +205,9 @@ class PagureMergePrNoForkTest(tests.Modeltests): user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): data = {"csrf_token": self.get_csrf()} - + # Check the PR view on UI + output = self.app.get("/test/pull-request/1") + self.assertEqual(output.status_code, 200) # Merge PR output = self.app.post( "/test/pull-request/1/merge", data=data, follow_redirects=True