[PATCH 5 of 7] pullrequests: draft comment on pull requests
Jan Heylen
heyleke at gmail.com
Tue Apr 14 12:03:43 EDT 2015
# HG changeset patch
# User Jan Heylen <heyleke at gmail.com>
# Date 1427526769 -3600
# Sat Mar 28 08:12:49 2015 +0100
# Node ID 48a64173a2187e3ea2822df54b3d0096176e76e3
# Parent f26b18234a7731a361f75e7a68ad143fc78218bf
pullrequests: draft comment on pull requests
diff -r f26b18234a77 -r 48a64173a218 kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py Sat Mar 28 08:12:09 2015 +0100
+++ b/kallithea/controllers/pullrequests.py Sat Mar 28 08:12:49 2015 +0100
@@ -667,6 +667,15 @@
for __, lines in c.inline_comments:
for comments in lines.values():
c.inline_cnt += len(comments)
+ # drafts
+ c.draft_cnt = 0
+ c.drafts = cc_model.get_inline_drafts(
+ c.db_repo.repo_id,
+ pull_request=pull_request_id)
+ # count drafts
+ for __, lines in c.drafts:
+ for draft in lines.values():
+ c.draft_cnt += len(draft)
# comments
c.comments = cc_model.get_comments(c.db_repo.repo_id,
pull_request=pull_request_id)
@@ -709,7 +718,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 +743,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