#NEWLINE# def mail_review( review , user , to_submitter_only ) : #NEWLINE# #INDENT# 'Send an e-mail representing the supplied review.\n\n    Args:\n        review (reviewboard.reviews.models.Review):\n            The review to send an e-mail about.\n\n        to_submitter_only (bool):\n            Determines if the review is to the submitter only or not.\n    ' #NEWLINE# review_request = review . review_request #NEWLINE# if ( not review_request . public ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# review . ordered_comments = review . comments . order_by ( 'filediff' , 'first_line' ) #NEWLINE# has_issues = ( review . comments . filter ( issue_opened = True ) . exists ( ) or review . file_attachment_comments . filter ( issue_opened = True ) . exists ( ) or review . screenshot_comments . filter ( issue_opened = True ) . exists ( ) ) #NEWLINE# extra_context = { #NEWLINE# #INDENT# 'user' : review . user , #NEWLINE# 'review' : review , #NEWLINE# 'has_issues' : has_issues , #NEWLINE# #UNINDENT# } #NEWLINE# extra_headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if review . ship_it : #NEWLINE# #INDENT# extra_headers [ 'X-ReviewBoard-ShipIt' ] = '1' #NEWLINE# if review . ship_it_only : #NEWLINE# #INDENT# extra_headers [ 'X-ReviewBoard-ShipIt-Only' ] = '1' #NEWLINE# #UNINDENT# #UNINDENT# ( has_error , extra_context [ 'comment_entries' ] ) = build_diff_comment_fragments ( review . ordered_comments , extra_context , 'notifications/email_diff_comment_fragment.html' ) #NEWLINE# reviewer = review . user #NEWLINE# limit_to = None #NEWLINE# if to_submitter_only : #NEWLINE# #INDENT# limit_to = set ( [ review_request . submitter , review . user ] ) #NEWLINE# #UNINDENT# ( to_field , cc_field ) = build_recipients ( reviewer , review_request , limit_recipients_to = limit_to ) #NEWLINE# ( to_field , cc_field ) = filter_email_recipients_from_hooks ( to_field , cc_field , review_published , review = review , user = user , review_request = review_request ) #NEWLINE# summary = _ensure_unicode ( review_request . summary ) #NEWLINE# review . email_message_id = send_review_mail ( reviewer , review_request , ( 'Re: Review Request %d: %s' % ( review_request . display_id , summary ) ) , review_request . email_message_id , to_field , cc_field , 'notifications/review_email.txt' , 'notifications/review_email.html' , extra_context , extra_headers = extra_headers ) #NEWLINE# review . time_emailed = timezone . now ( ) #NEWLINE# review . save ( )