comments: extend API data with references to commit_id or pull_request_id for audit-logs.

This commit is contained in:
Marcin Kuzminski 2020-04-15 15:46:53 +02:00
parent 13f313d4b5
commit 1e8d393f02
4 changed files with 11 additions and 4 deletions

View file

@ -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)

View file

@ -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": <pull_request_id>
}
],
error : null

View file

@ -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)

View file

@ -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