Table of Contents

  1. Course Overview
  2. Design Doc Components
    1. Title
    2. Summary
    3. Proposal(s)
    4. Deployment Process
    5. Open Questions
    6. Additional Notes
  3. Conclusion

Summary

When someone submits an application, we should be notified by email that an application has been submitted.

We should also send an email to the user telling them that we have received their application and linking them to the show page (user mentee application). We should also send a notification to the admin to let them know a new application has been submitted.

Proposals

I propose we use the existing pattern used on pair_request acceptance.

Proposal 1: send notification upon successfully creating the record

def create
		...

    ActiveRecord::Base.transaction do
      @user_mentee_application.save!
      current_user.resumes.create!(resume: resume_params[:resume], name: resume_params[:resume_name], current: true)
    end
    redirect_to @user_mentee_application, notice: 'Application succesfully submitted'
    
    send_notifications

    ... 
end

private
def send_notifications
    UserMenteeApplication::ApplicationSubmittedNotification.with(user_mentee_application: @user_mentee_application).deliver(@user_mentee_application.user)
  end

Pros:

  1. We wont need to create a background job

application_submitted_notification

class ApplicationSubmittedNotification < Noticed::Base
  deliver_by :email,
   mailer: "UserMailer",
   method: :application_submitted

  param :user_mentee_application

  def users_to_notify
    [params[:user_mentee_application].user, *User.admin]
  end
end