recruiter notification on interview status change re: #85

This commit is contained in:
Mark Moser
2016-11-30 18:55:27 -06:00
parent bcb840c986
commit fa27aac083
9 changed files with 103 additions and 18 deletions

View File

@ -32,27 +32,31 @@ module Admin
def approve
@candidate = Candidate.find_by(test_hash: params[:test_hash])
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
current_user.approve_candidate(@candidate)
results = {
message: "Interview requested!",
requestCopy: "Requested",
declineCopy: "Decline Interview"
}
render json: results.to_json
if current_user.approve_candidate(@candidate)
RecruiterMailer.interview_requested(@candidate).deliver_later
results = {
message: "Interview requested!",
requestCopy: "Requested",
declineCopy: "Decline Interview"
}
render json: results.to_json
end
end
def decline
@candidate = Candidate.find_by(test_hash: params[:test_hash])
authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id)
current_user.decline_candidate(@candidate)
results = {
message: "Interview declined.",
requestCopy: "Request Interview",
declineCopy: "Declined"
}
render json: results.to_json
if current_user.decline_candidate(@candidate)
RecruiterMailer.interview_declined(@candidate).deliver_later
results = {
message: "Interview declined.",
requestCopy: "Request Interview",
declineCopy: "Declined"
}
render json: results.to_json
end
end
end
end