# HG changeset patch # User Marcin Kuzminski # Date 2019-02-08 08:55:45 # Node ID 246c287b59f4b1490cd6f066b40a20a0f18b5809 # Parent e3886a396fb7fc8e034e03bce2d519cc74323e67 api: forbid commenting on closed PR 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 @@ -502,6 +502,11 @@ def comment_pull_request( else: raise JSONRPCError('userid is not the same as your user') + if pull_request.is_closed(): + raise JSONRPCError( + 'pull request `%s` comment failed, pull request is closed' % ( + pullrequestid,)) + if not PullRequestModel().check_user_read( pull_request, apiuser, api=True): raise JSONRPCError('repository `%s` does not exist' % (repoid,))