Ability for Review Request emails to make use of the cc field when sending out emails to the Review Group.

Review Request #478 — Created July 29, 2008 and submitted

Information

Review Board SVN (deprecated)

Reviewers

A high priority for us was to differentiate between the Reviewer and non-reviewer when the review request emails were being sent out. This differentiation informs easily who the Reviewer is for a given Request. I have coded up the following to meet those requirements.

The attached patch adds the following properties:
In the emails that are sent out by Review Board, if there is a reviewer present( i.e someone mentioned in the people category) then the 'to' field will have the email of the Reviewer and the 'cc' field will consists of the other members present in the group(except the reviewer ...of course).
If no one is mentioned then the email will be sent out normally.


!!!Requirements:
The EmailMessage class in django (django/core/mail.py) does not make use of the 'cc' field. Therefore to make use of the 'cc' field, the following needs to be done:

1)Go to this link--> http://code.djangoproject.com/ticket/7722 <-- and download the mail.diff  and patch it to your django/core/maily.py . This allows for email messages to now use the 'cc' field. Once the patch has been applied a slight change needs to be done. The patch results in an indentation error at line 215. Once that has been adjusted, you are good to go!



---
I know this requires some additional changes to be made to the EmailMessage class.....but this is the best that can be done to use the 'cc' field.

************************************************************************************************************
UPDATE 2 : 9/2/2008

Instead of going through the above process where you have to apply a patch to Django, it is now possible for ReviewBoard to make use of the cc fields when sending out emails. To reiterate...there is no need to make any changes to Django the feature has been incorporated into ReviewBoard.
I have tested it on my Review Board setup and It works fine.

*******************************************************************************************************
UPDATE 2 : 9/2/2008

Tested on local ReviewBoard setup (Fedora 9)
chipx86
  1. 
      
    1. Oh, and depending on a patch to Django won't work for this to get in, and that patch is scheduled for post-1.0, which we won't be requiring for some time.
      
      Since we already have a custom EmailMessage subclass, please add CC functionality to that directly. Should just be a matter of taking an extra variable and setting msg['Cc'] if there are any CC fields to set.
  2. trunk/reviewboard/reviews/email.py (Diff revision 1)
     
     
     
     
     
     
     
     
    I appreciate the comment but I think the code is pretty self-explanatory for the most part.
    
    What would help is a brief comment in the first conditional that says what exactly that is doing. The second one is obvious and won't need a comment.
    
    Remember to always put at least one space after the "#".
  3. trunk/reviewboard/reviews/email.py (Diff revision 1)
     
     
    Can be simplified to:
    
    if to_field:
  4. trunk/reviewboard/reviews/email.py (Diff revision 1)
     
     
    I'd prefer this to be a little more spelled out, if only to help people find the help info:
    
    cc_field = recipients.symmetric_difference(to_field)
  5. trunk/reviewboard/reviews/email.py (Diff revision 1)
     
     
    One space on each side of the "="
  6. 
      
david
  1. Committed with minor changes as r1486. Thanks!
  2. 
      
Loading...