def add_code_review(self, ticket, author, text, commit_id): ticket_fields = ticket.values from models.pull import PullRequest pullreq = PullRequest.get_by_ticket(ticket) uid = 'codereview-%s-%s-%s' % (pullreq.to_proj, ticket.id, commit_id) data = dict( date=datetime.now(), url="/%s/pull/%s" % (pullreq.to_proj, ticket.id), ticket=ticket.id, proj="%s:%s" % (pullreq.to_proj, pullreq.to_branch), receiver=ticket_fields['reporter'], author=author, text=text, uid=uid, ) self.add_code_review_data(data)
def format_code_review_info(sender, **kw): from models.pull import PullRequest comment = kw['comment'] anchor_id = comment.uid ticket = kw['ticket'] author = kw['author'] content = kw['content'] ticket_id = ticket.ticket_id pullreq = PullRequest.get_by_ticket(ticket) uid = 'newcodereview-%s-%s-%s' % ( pullreq.to_proj, ticket_id, comment.id) type = 'code_review' data = dict( date=datetime.now(), url="/%s/pull/%s/#%s" % (pullreq.to_proj, ticket_id, anchor_id), ticket=ticket_id, proj="%s:%s" % (pullreq.to_proj, pullreq.to_branch), receiver=ticket.author, author=author, text=content, uid=uid, type=type, ) return data