def createCommentFromMessage(self, message, vote, review_type, original_email, _notify_listeners=True, _validate=True): """See `IBranchMergeProposal`.""" if _validate: validate_message(original_email) review_type = self._normalizeReviewType(review_type) code_review_message = CodeReviewComment(branch_merge_proposal=self, message=message, vote=vote, vote_tag=review_type) # Get the appropriate CodeReviewVoteReference for the reviewer. # If there isn't one, then create one, otherwise set the comment # reference. if vote is not None: vote_reference = self._getVoteReference(message.owner, review_type) # Just set the reviewer and review type again on the off chance # that the user has edited the review_type or claimed a team # review. vote_reference.reviewer = message.owner vote_reference.review_type = review_type vote_reference.comment = code_review_message if _notify_listeners: notify( NewCodeReviewCommentEvent(code_review_message, original_email)) return code_review_message
def getComment(self, id): """See `IBranchMergeProposal`. This function can raise WrongBranchMergeProposal.""" comment = CodeReviewComment.get(id) if comment.branch_merge_proposal != self: raise WrongBranchMergeProposal return comment
def getComment(self, id): """See `IBranchMergeProposal`. This function can raise WrongBranchMergeProposal.""" comment = CodeReviewComment.get(id) if comment.branch_merge_proposal != self: raise WrongBranchMergeProposal return comment
def all_comments(self): """See `IBranchMergeProposal`.""" return CodeReviewComment.selectBy(branch_merge_proposal=self.id)
def all_comments(self): """See `IBranchMergeProposal`.""" return CodeReviewComment.selectBy(branch_merge_proposal=self.id)