diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 03520c4..d0ebed5 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -804,14 +804,15 @@ Reopened pull-request: ) -def notify_cancelled_pull_request(request, user): +def notify_closed_pull_request(request, user): """ Notify the people following a project that a pull-request was - cancelled in it. + closed in it. """ text = """ -%s canceled a pull-request against the project: `%s` that you are following. +%s closed without merging a pull-request against the project: `%s` that you +are following. -Cancelled pull-request: +Closed pull-request: `` %s diff --git a/pagure/lib/query.py b/pagure/lib/query.py index 7abbd8f..118e59a 100644 --- a/pagure/lib/query.py +++ b/pagure/lib/query.py @@ -3270,7 +3270,7 @@ def close_pull_request(session, request, user, merged=True): if merged is True: pagure.lib.notify.notify_merge_pull_request(request, user_obj) else: - pagure.lib.notify.notify_cancelled_pull_request(request, user_obj) + pagure.lib.notify.notify_closed_pull_request(request, user_obj) pagure.lib.git.update_git(request, repo=request.project) diff --git a/pagure/templates/repo_pull_request.html b/pagure/templates/repo_pull_request.html index 78f5358..2f1bef1 100644 --- a/pagure/templates/repo_pull_request.html +++ b/pagure/templates/repo_pull_request.html @@ -71,7 +71,7 @@ by {{ pull_request.user.user }}. {% elif pull_request.status == 'Closed' %} - Cancelled {{ pull_request.closed_at |humanize }} + Closed {{ pull_request.closed_at |humanize }} by {{ pull_request.closed_by.user }}. @@ -150,7 +150,7 @@ {% endif %}
{% endif %} @@ -158,9 +158,9 @@ {% if pull_request.status == 'Open' and g.authenticated and (g.repo_committer or g.fas_user.username == pull_request.user.username) %} {{ mergeform.csrf_token }} - {% endif %} {% if pull_request.status == 'Open' and g.authenticated and @@ -944,7 +944,7 @@ $(document).ready(function() { return false; }); - $('#cancel_pr').click(function(){ + $('#close_pr').click(function(){ return window.confirm("Are you sure you want to close this requested pull?"); }); diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 1527430..c0c743e 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -1218,21 +1218,21 @@ def merge_request_pull(repo, requestid, username=None, namespace=None): ) -@UI_NS.route("//pull-request/cancel/", methods=["POST"]) +@UI_NS.route("//pull-request/close/", methods=["POST"]) @UI_NS.route( - "///pull-request/cancel/", methods=["POST"] + "///pull-request/close/", methods=["POST"] ) @UI_NS.route( - "/fork///pull-request/cancel/", + "/fork///pull-request/close/", methods=["POST"], ) @UI_NS.route( - "/fork////pull-request/cancel/", + "/fork////pull-request/close/", methods=["POST"], ) @login_required -def cancel_request_pull(repo, requestid, username=None, namespace=None): - """ Cancel a pull request. +def close_request_pull(repo, requestid, username=None, namespace=None): + """ Close a pull request without merging it. """ form = pagure.forms.ConfirmationForm() @@ -1254,7 +1254,7 @@ def cancel_request_pull(repo, requestid, username=None, namespace=None): ): flask.abort( 403, - "You are not allowed to cancel pull-request for this project", + "You are not allowed to close pull-request for this project", ) pagure.lib.query.close_pull_request( diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index 42486a6..56231c0 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -1661,8 +1661,8 @@ index 0000000..2a552bb shutil.rmtree(newpath) @patch('pagure.lib.notify.send_email') - def test_cancel_request_pull(self, send_email): - """ Test the cancel_request_pull endpoint. """ + def test_close_request_pull(self, send_email): + """ Test the close_request_pull endpoint. """ send_email.return_value = True tests.create_projects(self.session) @@ -1673,11 +1673,11 @@ index 0000000..2a552bb user = tests.FakeUser() with tests.user_set(self.app.application, user): - output = self.app.post('/test/pull-request/cancel/1') + output = self.app.post('/test/pull-request/close/1') self.assertEqual(output.status_code, 302) output = self.app.post( - '/test/pull-request/cancel/1', follow_redirects=True) + '/test/pull-request/close/1', follow_redirects=True) self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) self.assertIn( @@ -1697,19 +1697,19 @@ index 0000000..2a552bb # Invalid project output = self.app.post( - '/foo/pull-request/cancel/1', data=data, + '/foo/pull-request/close/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 404) # Invalid PR id output = self.app.post( - '/test/pull-request/cancel/100', data=data, + '/test/pull-request/close/100', data=data, follow_redirects=True) self.assertEqual(output.status_code, 404) # Invalid user for this project output = self.app.post( - '/test/pull-request/cancel/1', data=data, + '/test/pull-request/close/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 403) @@ -1724,7 +1724,7 @@ index 0000000..2a552bb self.session.commit() output = self.app.post( - '/test/pull-request/cancel/1', data=data, + '/test/pull-request/close/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 404) @@ -1737,7 +1737,7 @@ index 0000000..2a552bb self.session.commit() output = self.app.post( - '/test/pull-request/cancel/1', data=data, + '/test/pull-request/close/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True)