#4007 Miscellaneous fixes
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+4 -3
@@ -6,13 +6,14 @@ 

  

  """

  

+ from alembic import op

+ import sqlalchemy as sa

+ ${imports if imports else ""}

+ 

  # revision identifiers, used by Alembic.

  revision = ${repr(up_revision)}

  down_revision = ${repr(down_revision)}

  

- from alembic import op

- import sqlalchemy as sa

- ${imports if imports else ""}

  

  def upgrade():

      ${upgrades if upgrades else "pass"}

file modified
+1 -1
@@ -541,7 +541,7 @@ 

  # Arguments to add to the SSH keys, possible replacements:

  # %(username)s: username owning this key

  SSH_KEYS_OPTIONS = (

-     "restrict,command=\"/usr/libexec/pagure/aclchecker.py %(username)s\""

+     'restrict,command="/usr/libexec/pagure/aclchecker.py %(username)s"'

  )

  

  # ACL Checker options

file modified
+5 -4
@@ -804,14 +804,15 @@ 

      )

  

  

- 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

file modified
+3 -3
@@ -403,14 +403,14 @@ 

      # Make sure we won't have SQLAlchemy error before we continue

      session.commit()

  

-     pagure.lib.git.update_git(issue, repo=issue.project)

- 

      if not notification:

          log_action(session, "commented", issue, user_obj)

  

      if notify:

          pagure.lib.notify.notify_new_comment(issue_comment, user=user_obj)

  

+     pagure.lib.git.update_git(issue, repo=issue.project)

+ 

      if not issue.private:

          pagure.lib.notify.log(

              issue.project,
@@ -3270,7 +3270,7 @@ 

      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)

  

@@ -71,7 +71,7 @@ 

              <span class="text-muted" title="{{ pull_request.user.html_title }}">by {{ pull_request.user.user }}.</span>

            {% elif pull_request.status == 'Closed' %}

              <span data-toggle="tooltip" title="{{pull_request.closed_at | format_datetime}}">

-               <span class="text-danger font-weight-bold">Cancelled</span> {{ pull_request.closed_at |humanize }}

+               <span class="text-danger font-weight-bold">Closed</span> {{ pull_request.closed_at |humanize }}

              </span>

              by

              <span title="{{ pull_request.closed_by.html_title }}">{{ pull_request.closed_by.user }}.</span>
@@ -150,7 +150,7 @@ 

                  {% endif %}

  

                <form style="display:inline;" action="{{ url_for(

-                   'ui_ns.cancel_request_pull', username=username,

+                   'ui_ns.close_request_pull', username=username,

                    namespace=repo.namespace,

                    repo=repo.name, requestid=requestid) }}" method="POST">

             {% 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 }}

-                   <button type="submit" value="Close" id="cancel_pr"

+                   <button type="submit" value="Close" id="close_pr"

                            class="btn btn-outline-danger btn-sm" title="Close PR without merging it" data-toggle="tooltip">

-                     <span class="fa fa-times"></span> Cancel

+                     <span class="fa fa-times"></span> Close

                    </button>

            {% endif %}

            {% if pull_request.status == 'Open' and g.authenticated and
@@ -944,7 +944,7 @@ 

      return false;

    });

  

-   $('#cancel_pr').click(function(){

+   $('#close_pr').click(function(){

      return window.confirm("Are you sure you want to close this requested pull?");

    });

  

file modified
+7 -7
@@ -1218,21 +1218,21 @@ 

      )

  

  

- @UI_NS.route("/<repo>/pull-request/cancel/<int:requestid>", methods=["POST"])

+ @UI_NS.route("/<repo>/pull-request/close/<int:requestid>", methods=["POST"])

  @UI_NS.route(

-     "/<namespace>/<repo>/pull-request/cancel/<int:requestid>", methods=["POST"]

+     "/<namespace>/<repo>/pull-request/close/<int:requestid>", methods=["POST"]

  )

  @UI_NS.route(

-     "/fork/<username>/<repo>/pull-request/cancel/<int:requestid>",

+     "/fork/<username>/<repo>/pull-request/close/<int:requestid>",

      methods=["POST"],

  )

  @UI_NS.route(

-     "/fork/<username>/<namespace>/<repo>/pull-request/cancel/<int:requestid>",

+     "/fork/<username>/<namespace>/<repo>/pull-request/close/<int:requestid>",

      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 @@ 

          ):

              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(

file modified
+1 -1
@@ -549,7 +549,7 @@ 

          subprocess.check_call(cmd, env=env)

          print()

          print("Python %s coverage: " % pyver)

-         cmd = [cover, "report", "--include=./pagure/*"]

+         cmd = [cover, "report", "--include=./pagure/*", "-m"]

          subprocess.check_call(cmd, env=env)

  

  

@@ -1661,8 +1661,8 @@ 

          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 @@ 

  

          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 @@ 

  

              # 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 @@ 

              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 @@ 

              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)