Mercurial > kallithea
changeset 6075:2e294e1fb9e2
routing: use POST for changeset_comment_delete and pullrequest_comment_delete instead of DELETE
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 04 Aug 2016 14:23:36 +0200 |
parents | 2dfbd29ae8f7 |
children | d2ce61e4363d |
files | kallithea/config/routing.py kallithea/public/js/base.js kallithea/tests/functional/test_changeset_comments.py |
diffstat | 3 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/config/routing.py Thu Aug 04 14:23:36 2016 +0200 +++ b/kallithea/config/routing.py Thu Aug 04 14:23:36 2016 +0200 @@ -627,9 +627,9 @@ conditions=dict(function=check_repo)) rmap.connect('changeset_comment_delete', - '/{repo_name:.*?}/changeset-comment-delete/{comment_id}', + '/{repo_name:.*?}/changeset-comment/{comment_id}/delete', controller='changeset', action='delete_comment', - conditions=dict(function=check_repo, method=["DELETE"])) + conditions=dict(function=check_repo, method=["POST"])) rmap.connect('changeset_info', '/changeset_info/{repo_name:.*?}/{revision}', controller='changeset', action='changeset_info') @@ -699,7 +699,7 @@ rmap.connect('pullrequest_comment_delete', '/{repo_name:.*?}/pull-request-comment/{comment_id}/delete', controller='pullrequests', action='delete_comment', - conditions=dict(function=check_repo, method=["DELETE"])) + conditions=dict(function=check_repo, method=["POST"])) rmap.connect('summary_home_summary', '/{repo_name:.*?}/summary', controller='summary', conditions=dict(function=check_repo))
--- a/kallithea/public/js/base.js Thu Aug 04 14:23:36 2016 +0200 +++ b/kallithea/public/js/base.js Thu Aug 04 14:23:36 2016 +0200 @@ -758,7 +758,7 @@ function deleteComment(comment_id) { var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id); - var postData = {'_method': 'delete'}; + var postData = {}; var success = function(o) { $('#comment-'+comment_id).remove(); // Ignore that this might leave a stray Add button (or have a pending form with another comment) ...
--- a/kallithea/tests/functional/test_changeset_comments.py Thu Aug 04 14:23:36 2016 +0200 +++ b/kallithea/tests/functional/test_changeset_comments.py Thu Aug 04 14:23:36 2016 +0200 @@ -127,11 +127,10 @@ assert len(comments) == 1 comment_id = comments[0].comment_id - self.app.post(url(controller='changeset', - action='delete_comment', + self.app.post(url("changeset_comment_delete", repo_name=HG_REPO, comment_id=comment_id), - params={'_method': 'delete', '_authentication_token': self.authentication_token()}) + params={'_authentication_token': self.authentication_token()}) comments = ChangesetComment.query().all() assert len(comments) == 0