diff --git a/rhodecode/api/tests/test_get_method.py b/rhodecode/api/tests/test_get_method.py --- a/rhodecode/api/tests/test_get_method.py +++ b/rhodecode/api/tests/test_get_method.py @@ -56,5 +56,6 @@ class TestGetMethod(object): 'request': '', 'resolves_comment_id': '', 'status': '', - 'userid': '>'}] + 'userid': '>', + 'send_email': ''}] assert_ok(id_, expected, given=response.body) diff --git a/rhodecode/api/views/pull_request_api.py b/rhodecode/api/views/pull_request_api.py --- a/rhodecode/api/views/pull_request_api.py +++ b/rhodecode/api/views/pull_request_api.py @@ -452,7 +452,7 @@ def comment_pull_request( message=Optional(None), commit_id=Optional(None), status=Optional(None), comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE), resolves_comment_id=Optional(None), extra_recipients=Optional([]), - userid=Optional(OAttr('apiuser'))): + userid=Optional(OAttr('apiuser')), send_email=Optional(True)): """ Comment on the pull request specified with the `pullrequestid`, in the |repo| specified by the `repoid`, and optionally change the @@ -483,6 +483,8 @@ def comment_pull_request( :type extra_recipients: Optional(list) :param userid: Comment on the pull request as this user :type userid: Optional(str or int) + :param send_email: Define if this comment should also send email notification + :type send_email: Optional(bool) Example output: @@ -527,6 +529,7 @@ def comment_pull_request( comment_type = Optional.extract(comment_type) resolves_comment_id = Optional.extract(resolves_comment_id) extra_recipients = Optional.extract(extra_recipients) + send_email = Optional.extract(send_email, binary=True) if not message and not status: raise JSONRPCError( @@ -587,7 +590,8 @@ def comment_pull_request( comment_type=comment_type, resolves_comment_id=resolves_comment_id, auth_user=auth_user, - extra_recipients=extra_recipients + extra_recipients=extra_recipients, + send_email=send_email ) if allowed_to_change_status and status: diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py --- a/rhodecode/api/views/repo_api.py +++ b/rhodecode/api/views/repo_api.py @@ -1551,7 +1551,7 @@ def comment_commit( request, apiuser, repoid, commit_id, message, status=Optional(None), comment_type=Optional(ChangesetComment.COMMENT_TYPE_NOTE), resolves_comment_id=Optional(None), extra_recipients=Optional([]), - userid=Optional(OAttr('apiuser'))): + userid=Optional(OAttr('apiuser')), send_email=Optional(True)): """ Set a commit comment, and optionally change the status of the commit. @@ -1575,6 +1575,8 @@ def comment_commit( :type extra_recipients: Optional(list) :param userid: Set the user name of the comment creator. :type userid: Optional(str or int) + :param send_email: Define if this comment should also send email notification + :type send_email: Optional(bool) Example error output: @@ -1610,6 +1612,7 @@ def comment_commit( comment_type = Optional.extract(comment_type) resolves_comment_id = Optional.extract(resolves_comment_id) extra_recipients = Optional.extract(extra_recipients) + send_email = Optional.extract(send_email, binary=True) allowed_statuses = [x[0] for x in ChangesetStatus.STATUSES] if status and status not in allowed_statuses: @@ -1639,7 +1642,8 @@ def comment_commit( comment_type=comment_type, resolves_comment_id=resolves_comment_id, auth_user=apiuser, - extra_recipients=extra_recipients + extra_recipients=extra_recipients, + send_email=send_email ) if status: # also do a status change