# HG changeset patch # User Marcin Kuzminski # Date 2020-04-15 13:46:53 # Node ID a588c9e66902ceb8746f4f01022cef51ec748e19 # Parent 5bc0438bc3a908c665fb5b6adbd7800680b7340f comments: extend API data with references to commit_id or pull_request_id for audit-logs. diff --git a/rhodecode/api/tests/test_get_pull_request_comments.py b/rhodecode/api/tests/test_get_pull_request_comments.py --- a/rhodecode/api/tests/test_get_pull_request_comments.py +++ b/rhodecode/api/tests/test_get_pull_request_comments.py @@ -60,7 +60,10 @@ class TestGetPullRequestComments(object) 'comment_text': 'Auto status change to |new_status|\n\n.. |new_status| replace:: *"Under Review"*', 'comment_type': 'note', 'comment_resolved_by': None, - 'pull_request_version': None} + 'pull_request_version': None, + 'comment_commit_id': None, + 'comment_pull_request_id': pull_request.pull_request_id + } ] assert_ok(id_, expected, 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 @@ -379,7 +379,9 @@ def get_pull_request_comments( }, "comment_text": "Example text", "comment_type": null, - "pull_request_version": null + "pull_request_version": null, + "comment_commit_id": None, + "comment_pull_request_id": } ], error : null 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 @@ -1655,7 +1655,7 @@ def comment_commit( except StatusChangeOnClosedPullRequestError: log.exception( "Exception occurred while trying to change repo commit status") - msg = ('Changing status on a changeset associated with ' + msg = ('Changing status on a commit associated with ' 'a closed pull request is not allowed') raise JSONRPCError(msg) diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -3815,7 +3815,9 @@ class ChangesetComment(Base, BaseModel): 'comment_lineno': comment.line_no, 'comment_author': comment.author, 'comment_created_on': comment.created_on, - 'comment_resolved_by': self.resolved + 'comment_resolved_by': self.resolved, + 'comment_commit_id': comment.revision, + 'comment_pull_request_id': comment.pull_request_id, } return data