[PATCH 1 of 2] controllers: remove pr_comment flag in delete_cs_pr_comment

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Nov 22 20:33:08 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1542916914 -3600
#      Thu Nov 22 21:01:54 2018 +0100
# Node ID 901a5f2f3530db95e7eda648a10ec47e03333020
# Parent  68f2eb1bec8c2b0f47e1382e2f2d0d62fe1e2b60
controllers: remove pr_comment flag in delete_cs_pr_comment

A separate comment is not really needed as we can check co.pull_request.

Suggested by Mads Killerich.

diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py
+++ b/kallithea/controllers/changeset.py
@@ -253,11 +253,11 @@ def create_cs_pr_comment(repo_name, revi
 
     return data
 
-def delete_cs_pr_comment(repo_name, comment_id, pr_comment=False):
+def delete_cs_pr_comment(repo_name, comment_id):
     co = ChangesetComment.get_or_404(comment_id)
     if co.repo.repo_name != repo_name:
         raise HTTPNotFound()
-    if pr_comment and co.pull_request.is_closed():
+    if co.pull_request and co.pull_request.is_closed():
         # don't allow deleting comments on closed pull request
         raise HTTPForbidden()
 
@@ -438,7 +438,7 @@ class ChangesetController(BaseRepoContro
     @HasRepoPermissionLevelDecorator('read')
     @jsonify
     def delete_comment(self, repo_name, comment_id):
-        return delete_cs_pr_comment(repo_name, comment_id, pr_comment=False)
+        return delete_cs_pr_comment(repo_name, comment_id)
 
     @LoginRequired(allow_default_user=True)
     @HasRepoPermissionLevelDecorator('read')
diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py
+++ b/kallithea/controllers/pullrequests.py
@@ -641,4 +641,4 @@ class PullrequestsController(BaseRepoCon
     @HasRepoPermissionLevelDecorator('read')
     @jsonify
     def delete_comment(self, repo_name, comment_id):
-        return delete_cs_pr_comment(repo_name, comment_id, pr_comment=True)
+        return delete_cs_pr_comment(repo_name, comment_id)


More information about the kallithea-general mailing list