def post_create_comm_note(note): """Stuff to do after creating note, also used in comm api's post_save.""" thread = note.thread obj = thread.obj # Add developer to thread. for developer in obj.authors.all(): thread.join_thread(developer) try: # Add Mozilla contact to thread. nonuser_mozilla_contacts = [] for email in obj.get_mozilla_contacts(): try: moz_contact = UserProfile.objects.get(email=email) thread.join_thread(moz_contact) except UserProfile.DoesNotExist: nonuser_mozilla_contacts.append((None, email)) utils_mail.email_recipients( nonuser_mozilla_contacts, note, extra_context={'nonuser_mozilla_contact': True}) except AttributeError: # Only apps have Mozilla contacts. pass # Add note author to thread. author = note.author if author: cc, created_cc = thread.join_thread(author) # Send out emails. utils_mail.send_mail_comm(note)
def post_create_comm_note(note): """Stuff to do after creating note, also used in comm api's post_save.""" thread = note.thread app = thread.addon # Add developer to thread. for developer in app.authors.all(): thread.join_thread(developer) # Add Mozilla contact to thread. for email in app.get_mozilla_contacts(): try: moz_contact = UserProfile.objects.get(email=email) thread.join_thread(moz_contact) except UserProfile.DoesNotExist: pass # Add note author to thread. author = note.author if author: cc, created_cc = thread.join_thread(author) # Send out emails. send_mail_comm(note)