[PATCH 6 of 8 v2] pullrequests controller: draft comment on pull requests backend code

Jan Heylen heyleke at gmail.com
Sat May 16 08:02:31 EDT 2015


# HG changeset patch
# User Jan Heylen <heyleke at gmail.com>
# Date 1431023355 -7200
#      Thu May 07 20:29:15 2015 +0200
# Node ID c2694f3dbb9202e979bc342ca5e60ae83e7c0591
# Parent  5e62c263fe2dbd6a46a6cd21e22b26bbf387e997
pullrequests controller: draft comment on pull requests backend code

diff -r 5e62c263fe2d -r c2694f3dbb92 kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py	Mon May 04 21:02:32 2015 +0200
+++ b/kallithea/controllers/pullrequests.py	Thu May 07 20:29:15 2015 +0200
@@ -667,6 +667,10 @@
         for __, lines in c.inline_comments:
             for comments in lines.values():
                 c.inline_cnt += len(comments)
+        # drafts
+        c.drafts = cc_model.get_inline_drafts(
+                                c.db_repo.repo_id,
+                                pull_request=pull_request_id)
         # comments
         c.comments = cc_model.get_comments(c.db_repo.repo_id,
                                            pull_request=pull_request_id)
@@ -709,7 +713,8 @@
             line_no=request.POST.get('line'),
             status_change=(ChangesetStatus.get_status_lbl(status)
                            if status and allowed_to_change_status else None),
-            closing_pr=close_pr
+            closing_pr=close_pr,
+            draft=True
         )
 
         action_logger(self.authuser,
@@ -733,6 +738,9 @@
                               'user_closed_pull_request:%s' % pull_request_id,
                               c.db_repo, self.ip_addr, self.sa)
 
+        ChangesetCommentsModel().commit_drafts(c.db_repo.repo_id,c.authuser.user_id,pull_request=pull_request_id, status_change=(ChangesetStatus.get_status_lbl(status)
+                           if status and allowed_to_change_status else None))
+
         Session().commit()
 
         if not request.environ.get('HTTP_X_PARTIAL_XHR'):


More information about the kallithea-general mailing list