From 75c7c9c1a806641755a251d0a64afadae256a622 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 07 2017 10:45:05 +0000 Subject: Fix figuring out which branches are not merged in namespaced project Fixes https://pagure.io/pagure/issue/1829 --- diff --git a/pagure/internal/__init__.py b/pagure/internal/__init__.py index 594f220..c338725 100644 --- a/pagure/internal/__init__.py +++ b/pagure/internal/__init__.py @@ -251,6 +251,7 @@ def get_pull_request_ready_branch(): repo = pagure.lib.get_project( pagure.SESSION, flask.request.form.get('repo', '').strip() or None, + namespace=flask.request.form.get('namespace', '').strip() or None, user=flask.request.form.get('repouser', '').strip() or None) if not repo: diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index 28035d3..076b6fa 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -109,7 +109,7 @@ git push -u origin master {% endif %} {% for branch in g.branches if branch != head%} -
+
{% if branchname != branch %} @@ -127,7 +127,7 @@ git push -u origin master
{% if g.repo_admin and branch != head %} -
{{ form.csrf_token }} + onclick="$('#delete_branch_form-{{ branch | replace('/', '__') | replace('.', '\\\\.') }}').submit();">
@@ -288,6 +288,7 @@ $(function() { url: '{{ url_for("internal_ns.get_pull_request_ready_branch") }}' , type: 'POST', data: { + namespace: "{{ repo.namespace }}", repo: "{{ repo.name }}", repouser: "{{ repo.user.user if repo.is_fork else '' }}", csrf_token: "{{ form.csrf_token.current_token }}", @@ -331,7 +332,8 @@ $(function() { commit not in the main branch. Click to create new PR now.'+'"> New PR \
'; {%endif%} - $('#branch-' + branch.replace('.', '\\.') + ' .branch_del').prepend(html2); + $('#branch-' + branch.replace('.', '\\.').replace('/', '__') + + ' .branch_del').prepend(html2); $('[data-toggle="tooltip"]').tooltip({placement : 'bottom'}); } for (branch in res.message.branch_w_pr){ @@ -349,7 +351,8 @@ $(function() { + 'PR#' + res.message.branch_w_pr[branch] + ' \
'; console.log(html); - $('#branch-' + branch.replace('.', '\\.') + ' .branch_del').prepend(html); + $('#branch-' + branch.replace('.', '\\.').replace('/', '__') + + ' .branch_del').prepend(html); $('[data-toggle="tooltip"]').tooltip({placement : 'bottom'}); } } diff --git a/pagure/templates/requests.html b/pagure/templates/requests.html index 872e1ef..294433e 100644 --- a/pagure/templates/requests.html +++ b/pagure/templates/requests.html @@ -258,6 +258,7 @@ $(function() { type: 'POST', data: { repo: "{{ repo.name }}", + namespace: "{{ repo.namespace }}", repouser: "", csrf_token: "{{ form.csrf_token.current_token }}", },