app/models/applications/application_for_offering.rb
# Sends status update to applicants, staff, mentors, and verified group members.
Sends status update to applicants, staff, mentors, and verified group members.
Sends status update to applicants staff mentors and verified group members .
def send_status_update(email, deliver_emails_now = true, status = nil)
    if email.send_to == "applicant"
      cc_to_feedback_person = email.cc_to_feedback_person?
      email_object = ApplyMailer.create_status_update(self, email.email_template, self.person.email, Time.now, 
                                                      apply_url(:host => CONSTANTS[:base_url_host], 
                                                                :offering => offering),
                                                      apply_url(:host => CONSTANTS[:base_url_host], 
                                                                :offering => offering) + "/availability",
                                                      cc_to_feedback_person)
      if deliver_emails_now
        EmailContact.log self.person.id, ApplyMailer.deliver(email_object), status
      else
        EmailQueue.queue self.person.id, email_object, status
      end
    elsif email.send_to == "staff"
      if deliver_emails_now
        ApplyMailer.deliver_status_update(self, email.email_template, self.offering.notify_email || self.offering.contact_email) 
      end
    elsif email.send_to == "group_members"
      self.group_members.verified.each do |group_member|
        group_member.reload
        self.send_group_member_status_update(group_member, email, deliver_emails_now, status)
      end
    elsif email.send_to == "mentors"
      self.mentors.each do |mentor|
        mentor.reload
        unless (mentor.letter_received? && status.name == "submitted") || mentor.invite_email_sent? 
          if mentor.no_email
            ApplyMailer.deliver_mentor_no_email_warning(mentor, self.offering.notify_email)
          else
            self.send_mentor_status_update(mentor,email, deliver_emails_now, status)
          end
        end
      end
    end
  end
def send_status_update ( email , deliver_emails_now = true , status = nil ) if email . send_to == "applicant" cc_to_feedback_person = email . cc_to_feedback_person? email_object = ApplyMailer . create_status_update ( self , email . email_template , self . person . email , Time . now , apply_url ( :host => CONSTANTS [ :base_url_host ] , :offering => offering ) , apply_url ( :host => CONSTANTS [ :base_url_host ] , :offering => offering ) + "/availability" , cc_to_feedback_person ) if deliver_emails_now EmailContact . log self . person . id , ApplyMailer . deliver ( email_object ) , status else EmailQueue . queue self . person . id , email_object , status end elsif email . send_to == "staff" if deliver_emails_now ApplyMailer . deliver_status_update ( self , email . email_template , self . offering . notify_email || self . offering . contact_email ) end elsif email . send_to == "group_members" self . group_members . verified . each do | group_member | group_member . reload self . send_group_member_status_update ( group_member , email , deliver_emails_now , status ) end elsif email . send_to == "mentors" self . mentors . each do | mentor | mentor . reload unless ( mentor . letter_received? && status . name == "submitted" ) || mentor . invite_email_sent? if mentor . no_email ApplyMailer . deliver_mentor_no_email_warning ( mentor , self . offering . notify_email ) else self . send_mentor_status_update ( mentor , email , deliver_emails_now , status ) end end end end end
Sends status update to applicants, staff, mentors, and verified group members.
Sends status update to applicants staff mentors and verified group members .
# don't log messages to staff # don't send the "please submit a letter" email if submitted
email
deliver_emails_now
status