##// END OF EJS Templates
api: add send_email flag for comments api to allow commenting without email notification....
bart -
r4196:bb0e450f stable
parent child Browse files
Show More
@@ -56,5 +56,6 b' class TestGetMethod(object):'
56 'request': '<RequiredType>',
56 'request': '<RequiredType>',
57 'resolves_comment_id': '<Optional:None>',
57 'resolves_comment_id': '<Optional:None>',
58 'status': '<Optional:None>',
58 'status': '<Optional:None>',
59 'userid': '<Optional:<OptionalAttr:apiuser>>'}]
59 'userid': '<Optional:<OptionalAttr:apiuser>>',
60 'send_email': '<Optional:True>'}]
60 assert_ok(id_, expected, given=response.body)
61 assert_ok(id_, expected, given=response.body)
@@ -452,7 +452,7 b' def comment_pull_request('
452 message=Optional(None), commit_id=Optional(None), status=Optional(None),
452 message=Optional(None), commit_id=Optional(None), status=Optional(None),
453 comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE),
453 comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE),
454 resolves_comment_id=Optional(None), extra_recipients=Optional([]),
454 resolves_comment_id=Optional(None), extra_recipients=Optional([]),
455 userid=Optional(OAttr('apiuser'))):
455 userid=Optional(OAttr('apiuser')), send_email=Optional(True)):
456 """
456 """
457 Comment on the pull request specified with the `pullrequestid`,
457 Comment on the pull request specified with the `pullrequestid`,
458 in the |repo| specified by the `repoid`, and optionally change the
458 in the |repo| specified by the `repoid`, and optionally change the
@@ -483,6 +483,8 b' def comment_pull_request('
483 :type extra_recipients: Optional(list)
483 :type extra_recipients: Optional(list)
484 :param userid: Comment on the pull request as this user
484 :param userid: Comment on the pull request as this user
485 :type userid: Optional(str or int)
485 :type userid: Optional(str or int)
486 :param send_email: Define if this comment should also send email notification
487 :type send_email: Optional(bool)
486
488
487 Example output:
489 Example output:
488
490
@@ -527,6 +529,7 b' def comment_pull_request('
527 comment_type = Optional.extract(comment_type)
529 comment_type = Optional.extract(comment_type)
528 resolves_comment_id = Optional.extract(resolves_comment_id)
530 resolves_comment_id = Optional.extract(resolves_comment_id)
529 extra_recipients = Optional.extract(extra_recipients)
531 extra_recipients = Optional.extract(extra_recipients)
532 send_email = Optional.extract(send_email, binary=True)
530
533
531 if not message and not status:
534 if not message and not status:
532 raise JSONRPCError(
535 raise JSONRPCError(
@@ -587,7 +590,8 b' def comment_pull_request('
587 comment_type=comment_type,
590 comment_type=comment_type,
588 resolves_comment_id=resolves_comment_id,
591 resolves_comment_id=resolves_comment_id,
589 auth_user=auth_user,
592 auth_user=auth_user,
590 extra_recipients=extra_recipients
593 extra_recipients=extra_recipients,
594 send_email=send_email
591 )
595 )
592
596
593 if allowed_to_change_status and status:
597 if allowed_to_change_status and status:
@@ -1551,7 +1551,7 b' def comment_commit('
1551 request, apiuser, repoid, commit_id, message, status=Optional(None),
1551 request, apiuser, repoid, commit_id, message, status=Optional(None),
1552 comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE),
1552 comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE),
1553 resolves_comment_id=Optional(None), extra_recipients=Optional([]),
1553 resolves_comment_id=Optional(None), extra_recipients=Optional([]),
1554 userid=Optional(OAttr('apiuser'))):
1554 userid=Optional(OAttr('apiuser')), send_email=Optional(True)):
1555 """
1555 """
1556 Set a commit comment, and optionally change the status of the commit.
1556 Set a commit comment, and optionally change the status of the commit.
1557
1557
@@ -1575,6 +1575,8 b' def comment_commit('
1575 :type extra_recipients: Optional(list)
1575 :type extra_recipients: Optional(list)
1576 :param userid: Set the user name of the comment creator.
1576 :param userid: Set the user name of the comment creator.
1577 :type userid: Optional(str or int)
1577 :type userid: Optional(str or int)
1578 :param send_email: Define if this comment should also send email notification
1579 :type send_email: Optional(bool)
1578
1580
1579 Example error output:
1581 Example error output:
1580
1582
@@ -1610,6 +1612,7 b' def comment_commit('
1610 comment_type = Optional.extract(comment_type)
1612 comment_type = Optional.extract(comment_type)
1611 resolves_comment_id = Optional.extract(resolves_comment_id)
1613 resolves_comment_id = Optional.extract(resolves_comment_id)
1612 extra_recipients = Optional.extract(extra_recipients)
1614 extra_recipients = Optional.extract(extra_recipients)
1615 send_email = Optional.extract(send_email, binary=True)
1613
1616
1614 allowed_statuses = [x[0] for x in ChangesetStatus.STATUSES]
1617 allowed_statuses = [x[0] for x in ChangesetStatus.STATUSES]
1615 if status and status not in allowed_statuses:
1618 if status and status not in allowed_statuses:
@@ -1639,7 +1642,8 b' def comment_commit('
1639 comment_type=comment_type,
1642 comment_type=comment_type,
1640 resolves_comment_id=resolves_comment_id,
1643 resolves_comment_id=resolves_comment_id,
1641 auth_user=apiuser,
1644 auth_user=apiuser,
1642 extra_recipients=extra_recipients
1645 extra_recipients=extra_recipients,
1646 send_email=send_email
1643 )
1647 )
1644 if status:
1648 if status:
1645 # also do a status change
1649 # also do a status change
General Comments 0
You need to be logged in to leave comments. Login now