From 749cd599c1d911a8d23ee53b1c13fe0fdc0efe1f Mon Sep 17 00:00:00 2001 From: Denise Yu Date: Wed, 13 Apr 2016 20:39:09 +0100 Subject: [PATCH 1/6] add more credentials --- config/environments/production.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 53faaf233..270b015a8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -73,7 +73,8 @@ :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_APIKEY'], :domain => 'codebar.io', - :authentication => :plain + :authentication => :plain, + :enable_starttls_auto => true } ActionMailer::Base.delivery_method = :smtp From d55ab700f2b4c33e0287eb78ccd10e401504824a Mon Sep 17 00:00:00 2001 From: Denise Yu Date: Wed, 13 Apr 2016 20:46:26 +0100 Subject: [PATCH 2/6] try setting domain to heroku --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 270b015a8..17a37b41e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -72,7 +72,7 @@ :address => 'smtp.sendgrid.net', :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_APIKEY'], - :domain => 'codebar.io', + :domain => 'heroku.com', :authentication => :plain, :enable_starttls_auto => true } From 5ca1756fb3b9f648009cde7a527e408d2722b171 Mon Sep 17 00:00:00 2001 From: Denise Yu Date: Wed, 13 Apr 2016 20:49:08 +0100 Subject: [PATCH 3/6] omg --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 17a37b41e..a0ce19165 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -71,7 +71,7 @@ :port => '587', :address => 'smtp.sendgrid.net', :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_APIKEY'], + :password => ENV['SENDGRID_PASSWORD'], :domain => 'heroku.com', :authentication => :plain, :enable_starttls_auto => true From 2b1f4a2fed9190877373a87c0f2f244df15fc142 Mon Sep 17 00:00:00 2001 From: Denise Date: Sun, 24 Apr 2016 18:51:32 +0100 Subject: [PATCH 4/6] derp.. --- app/controllers/admin/meetings_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/admin/meetings_controller.rb b/app/controllers/admin/meetings_controller.rb index 01ed3c74f..9199e4ea9 100644 --- a/app/controllers/admin/meetings_controller.rb +++ b/app/controllers/admin/meetings_controller.rb @@ -48,6 +48,8 @@ def invite @meeting.invitees.each do |invitee| MeetingInvitationMailer.invite(@meeting, invitee).deliver_now end + + redirect_to admin_meeting_path(@meeting), notice: "Invitations are being sent out." end private From 72e3bbe0a571a3208d208847dff000ed4314d2f8 Mon Sep 17 00:00:00 2001 From: Denise Date: Sun, 22 May 2016 18:00:09 +0100 Subject: [PATCH 5/6] Automate monthly reminder emails --- app/mailers/meeting_invitation_mailer.rb | 32 ++++++---- app/models/.keep | 0 app/models/invitation_manager.rb | 6 ++ .../attendance_reminder.html.haml | 58 +++++++++++++++++++ lib/tasks/reminders.rake | 11 ++++ 5 files changed, 95 insertions(+), 12 deletions(-) delete mode 100644 app/models/.keep create mode 100644 app/views/meeting_invitation_mailer/attendance_reminder.html.haml diff --git a/app/mailers/meeting_invitation_mailer.rb b/app/mailers/meeting_invitation_mailer.rb index c7565978f..82dbf38e9 100644 --- a/app/mailers/meeting_invitation_mailer.rb +++ b/app/mailers/meeting_invitation_mailer.rb @@ -5,10 +5,7 @@ class MeetingInvitationMailer < ActionMailer::Base helper ApplicationHelper def invite meeting, member - @member = member - @meeting = meeting - @rsvp_url = meeting_url(@meeting) - @host_address = AddressDecorator.new(@meeting.venue.address) + set_vars subject = "You are invited to codebar's #{@meeting.name} on #{humanize_date(@meeting.date_and_time)}" mail(mail_args(member, subject)) do |format| @@ -17,10 +14,7 @@ def invite meeting, member end def attending meeting, member, invitation - @member = member - @meeting = meeting - @host_address = AddressDecorator.new(@meeting.venue.address) - @cancellation_url = meeting_url(@meeting) + set_vars subject = "See you at #{@meeting.name} on #{humanize_date(@meeting.date_and_time)}" mail(mail_args(member, subject)) do |format| @@ -29,15 +23,29 @@ def attending meeting, member, invitation end def approve_from_waitlist meeting, member, invitation - @member = member - @meeting = meeting - @host_address = AddressDecorator.new(@meeting.venue.address) - @cancellation_url = meeting_url(@meeting) + set_vars subject = "A spot opened up for #{@meeting.name} on #{humanize_date(@meeting.date_and_time)}" mail(mail_args(member, subject)) do |format| format.html end + end + def attendance_reminder meeting, member + set_vars + + subject = "Reminder: You have a spot for #{@meeting.name} on #{humanize_date(@meeting.date_and_time)}" + mail(mail_args(member, subject)) do |format| + format.html + end + end + + private + + def set_vars + @member = member + @meeting = meeting + @host_address = AddressDecorator.new(@meeting.venue.address) + @cancellation_url = meeting_url(@meeting) end end diff --git a/app/models/.keep b/app/models/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/models/invitation_manager.rb b/app/models/invitation_manager.rb index e22ea91b0..a64f6a283 100644 --- a/app/models/invitation_manager.rb +++ b/app/models/invitation_manager.rb @@ -40,6 +40,12 @@ def send_event_emails event, chapter handle_asynchronously :send_event_emails + def self.send_monthly_attendance_reminder_emails monthly + monthly.attendances.map(&:member).each do |member| + MeetingInvitationMailer.attendance_reminder(monthly, member) + end + end + def self.send_course_emails course course.chapter.groups.students.map(&:members).flatten.uniq.each do |student| invitation = CourseInvitation.new(course: course, member: student) diff --git a/app/views/meeting_invitation_mailer/attendance_reminder.html.haml b/app/views/meeting_invitation_mailer/attendance_reminder.html.haml new file mode 100644 index 000000000..1464becfe --- /dev/null +++ b/app/views/meeting_invitation_mailer/attendance_reminder.html.haml @@ -0,0 +1,58 @@ +=render partial: 'shared_mailers/header', locals: { title: "codebar Monthly Attendance Reminder" } +%body{ bgcolor: "#FFFFFF" } + + =render partial: 'shared_mailers/body_header', locals: { title: "codebar Monthly Attendance Reminder" } + + %table{ class: "body-wrap"} + %tr + %td + %td{ class: "container", bgcolor: "#FFFFFF" } + + .content + %table + %tr + %td + %h3 Hi, #{@member.name} + %p.lead + This is a quick email to remind you that you have signed up for tomorrow's Monthly. + %p + Please be advised that repeated no-shows to codebar events, including Monthlies, will result in suspension of your invitations. No +1s are allowed for Monthlies. + %p + The talks will begin promptly at 7:00, food and drinks will be served from 6:30. + %h4 + Agenda + %p + = @meeting.description.html_safe + %h4 + Can't make it anymore? + %p + = "Please #{link_to 'cancel your attendance', @cancellation_url} by following the instructions on the event page.".html_safe + + .content + %table{ bgcolor: "#FFFFFF" } + %tr + %td.small{ width: "30%", style: "vertical-align: top; padding-right:10px;"} + =image_tag(@meeting.venue.avatar) + %td + %h4 + Workshop + %small #{humanize_date_with_time(@meeting.date_and_time)} + %p + #{@meeting.venue.name} + %br + #{@host_address.to_html} + + .content + %table + %tr + %td + %p + If you have any trouble finding the venue, give us a call + - @meeting.organisers.each do |organiser| + %p + = organiser.full_name + = organiser.mobile + %br + + .content + = render partial: 'shared_mailers/social' diff --git a/lib/tasks/reminders.rake b/lib/tasks/reminders.rake index 8ff60935c..0bce7b56b 100644 --- a/lib/tasks/reminders.rake +++ b/lib/tasks/reminders.rake @@ -13,4 +13,15 @@ namespace :reminders do end end end + + task meeting: :environment do + meetings = Meeting.upcoming + + meetings.each do |meeting| + if Time.zone.now.between?(workshop.date_and_time-30.hours, workshop.date_and_time - 4.hours) + STDOUT.puts "Sending attendance reminders for #{meeting.name}..." + InvitationManager.send_monthly_attendance_reminder_emails meeting + end + end + end end From de32d16b8ca711ce7cf35de0bea8562171177b0e Mon Sep 17 00:00:00 2001 From: Denise Date: Sun, 22 May 2016 18:00:21 +0100 Subject: [PATCH 6/6] Change copy in eligibility check email --- app/views/member_mailer/eligibility_check.html.haml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/member_mailer/eligibility_check.html.haml b/app/views/member_mailer/eligibility_check.html.haml index 960b0dca3..edc62ef28 100644 --- a/app/views/member_mailer/eligibility_check.html.haml +++ b/app/views/member_mailer/eligibility_check.html.haml @@ -3,26 +3,25 @@ %p We noticed that you recently signed up for a codebar workshop. Our workshops are open to everyone who meet our - = link_to "eligibility criteria.", "http://codebar.io/faq" + = link_to "eligibility criteria.", "http://codebar.io/student-guide#eligibility" %p The reason we are getting in touch is because we cannot tell from your name or social media accounts if you identify as a female. Male students who belong - to an underrepresented minority group or identify as LGBTQ are welcome. + to an underrepresented ethnic minority group or identify as LGBTQ are welcome. %p %strong We wish we didn't have to do this, but we hope you understand why we need to ask. We would appreciate if you could reply to this email with a short confirmation that you belong to an eligible group (you do not need to specify which). - %strong %p We take this issue very seriously, and we appreciate your cooperation. %p - If you do not confirm over email before the upcoming workshop, the organisers - reserve the right to verify with you in person. + If you do not confirm over email by 12:00 on the day of the workshop, the organisers + will be reallocating your spot to the next person on the waitlist and suspending your invitations. %p Thanks for your understanding.