[PATCH 07 of 14] controllers: changeset: catch status changes on inline comments

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Nov 20 20:32:18 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1541880328 -3600
#      Sat Nov 10 21:05:28 2018 +0100
# Node ID cfdb93ba1005f12171504bdbfd7df2562329c397
# Parent  7350230aa3578c3fc3a4aff864e35a02eea216e1
controllers: changeset: catch status changes on inline comments

This is a preparation on sharing the same comment method between
pullrequests and changeset controllers.

diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py
+++ b/kallithea/controllers/changeset.py
@@ -369,14 +369,21 @@ class ChangesetController(BaseRepoContro
         assert request.environ.get('HTTP_X_PARTIAL_XHR')
 
         status = request.POST.get('changeset_status')
+        f_path = request.POST.get('f_path')
+        line_no = request.POST.get('line')
+
+        if status and (f_path or line_no):
+            # status votes are only possible in general comments
+            raise HTTPBadRequest()
+
         text = request.POST.get('text', '').strip()
 
         c.comment = create_comment(
             text,
             status,
             revision=revision,
-            f_path=request.POST.get('f_path'),
-            line_no=request.POST.get('line'),
+            f_path=f_path,
+            line_no=line_no,
         )
 
         # get status if set !


More information about the kallithea-general mailing list