Notify with anonymised email on new volunteer (#48)

People enjoy the instant gratification of a random alert.

This brings back email notifications to organizers on volunteer sign-up so that relevant people can react as soon as possible.

The email now will contain anonymous data (team name and t-shirt size) and a link for curious people to view the profile.

I have considered adding another email address for such notifications, but it seems unnecessarily complicated.

Proof of work:

![image](/attachments/dabd0375-17ac-43c8-9698-678e768aa111)

![image](/attachments/fed16195-e668-47c7-9647-5fe069f1ed2d)

Reviewed-on: #48
Co-authored-by: Tocho Tochev <tocho@tochev.net>
Co-committed-by: Tocho Tochev <tocho@tochev.net>
This commit is contained in:
Tocho Tochev 2024-06-01 12:32:39 +03:00 committed by Petko Bordjukov
parent bcac28d4ff
commit 459be53b5c
3 changed files with 10 additions and 15 deletions

View File

@ -4,7 +4,7 @@ class VolunteerMailer < ActionMailer::Base
mail( mail(
to: @volunteer.conference.email, to: @volunteer.conference.email,
subject: "Нов доброволец за #{@volunteer.conference.title}" subject: "Нов доброволец за #{@volunteer.conference.title} - #{@volunteer.volunteer_team.name}"
) )
end end

View File

@ -24,6 +24,7 @@ class Volunteer < ActiveRecord::Base
before_create :assign_unique_id before_create :assign_unique_id
before_create :assign_confirmation_token before_create :assign_confirmation_token
after_commit :send_email_confirmation_to_volunteer, on: [:create] 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 def send_notification_to_volunteer
VolunteerMailer.volunteer_notification(self).deliver_later VolunteerMailer.volunteer_notification(self).deliver_later
@ -47,6 +48,10 @@ class Volunteer < ActiveRecord::Base
VolunteerMailer.volunteer_email_confirmation(self).deliver_later VolunteerMailer.volunteer_email_confirmation(self).deliver_later
end end
def send_email_to_organisers
VolunteerMailer.team_notification(self).deliver_later
end
def volunteer_teams_belong_to_conference def volunteer_teams_belong_to_conference
conference_volunteer_teams = conference.volunteer_teams conference_volunteer_teams = conference.volunteer_teams
unless additional_volunteer_teams.all? { |team| conference_volunteer_teams.include? team } unless additional_volunteer_teams.all? { |team| conference_volunteer_teams.include? team }

View File

@ -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.language %>
Телефон: <%= @volunteer.phone %>
Размер на тениска: <%= @volunteer.tshirt_size %> Размер на тениска: <%= @volunteer.tshirt_size %>
Кройка на тениска: <%= @volunteer.tshirt_cut %> Кройка на тениска: <%= @volunteer.tshirt_cut %>
Предпочитания за храна: <%= @volunteer.food_preferences %>
<% if @volunteer.previous_experience.present? -%>
Предходен опит:
<%= @volunteer.previous_experience %>
<% end -%>
<% if @volunteer.notes.present? -%>
Бележки:
<%= @volunteer.notes %>
<% end -%>