From 5a0efc7581a269dc81062c707540e506856a20ad Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Sat, 18 May 2024 23:10:12 +0300 Subject: [PATCH] Notify with anonymised email on new volunteer --- app/mailers/volunteer_mailer.rb | 2 +- app/models/volunteer.rb | 5 +++++ .../team_notification.text.erb | 18 ++++-------------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/app/mailers/volunteer_mailer.rb b/app/mailers/volunteer_mailer.rb index fa99ed1..001fee3 100644 --- a/app/mailers/volunteer_mailer.rb +++ b/app/mailers/volunteer_mailer.rb @@ -4,7 +4,7 @@ class VolunteerMailer < ActionMailer::Base mail( to: @volunteer.conference.email, - subject: "Нов доброволец за #{@volunteer.conference.title}" + subject: "Нов доброволец за #{@volunteer.conference.title} - #{@volunteer.volunteer_team.name}" ) end diff --git a/app/models/volunteer.rb b/app/models/volunteer.rb index cb1be3b..5368e52 100644 --- a/app/models/volunteer.rb +++ b/app/models/volunteer.rb @@ -24,6 +24,7 @@ class Volunteer < ActiveRecord::Base before_create :assign_unique_id before_create :assign_confirmation_token after_commit :send_email_confirmation_to_volunteer, on: [:create] + after_commit :send_email_to_organisers, on: [:create] # technically the email is not confirmed yet def send_notification_to_volunteer VolunteerMailer.volunteer_notification(self).deliver_later @@ -47,6 +48,10 @@ class Volunteer < ActiveRecord::Base VolunteerMailer.volunteer_email_confirmation(self).deliver_later end + def send_email_to_organisers + VolunteerMailer.team_notification(self).deliver_later + end + def volunteer_teams_belong_to_conference conference_volunteer_teams = conference.volunteer_teams unless additional_volunteer_teams.all? { |team| conference_volunteer_teams.include? team } diff --git a/app/views/volunteer_mailer/team_notification.text.erb b/app/views/volunteer_mailer/team_notification.text.erb index 8ede00f..858d446 100644 --- a/app/views/volunteer_mailer/team_notification.text.erb +++ b/app/views/volunteer_mailer/team_notification.text.erb @@ -1,21 +1,11 @@ Здравейте, -<%= @volunteer.name %> <<%= @volunteer.email %>> изпрати кандидатура за доброволец. +Някой изпрати кандидатура за доброволец. -Екипи: <%= @volunteer.volunteer_teams.map(&:name).join(', ') %> +Екип: <%= @volunteer.volunteer_team.name %> + +Връзка към профил: <%= management_conference_volunteer_url(@volunteer.conference, @volunteer) %> Език: <%= @volunteer.language %> -Телефон: <%= @volunteer.phone %> Размер на тениска: <%= @volunteer.tshirt_size %> Кройка на тениска: <%= @volunteer.tshirt_cut %> -Предпочитания за храна: <%= @volunteer.food_preferences %> -<% if @volunteer.previous_experience.present? -%> - -Предходен опит: -<%= @volunteer.previous_experience %> -<% end -%> -<% if @volunteer.notes.present? -%> - -Бележки: -<%= @volunteer.notes %> -<% end -%> -- 2.40.1