Refactored EmailSetting incosistency. Fixes #603
This commit is contained in:
parent
f9c41cf670
commit
0c4b0b4ac1
13 changed files with 99 additions and 88 deletions
|
|
@ -5,7 +5,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
person.email,
|
||||
conference.email_settings.registration_subject,
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, person, conference.email_settings.registration_email_template))
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, person, conference.email_settings.registration_body))
|
||||
end
|
||||
|
||||
def acceptance_mail(event)
|
||||
|
|
@ -14,7 +14,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
person.email,
|
||||
conference.email_settings.accepted_subject,
|
||||
conference.email_settings.generate_event_mail(event, conference.email_settings.accepted_email_template))
|
||||
conference.email_settings.generate_event_mail(event, conference.email_settings.accepted_body))
|
||||
end
|
||||
|
||||
def rejection_mail(event)
|
||||
|
|
@ -23,7 +23,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
person.email,
|
||||
conference.email_settings.rejected_subject,
|
||||
conference.email_settings.generate_event_mail(event, conference.email_settings.rejected_email_template))
|
||||
conference.email_settings.generate_event_mail(event, conference.email_settings.rejected_body))
|
||||
end
|
||||
|
||||
def confirm_reminder_mail(event)
|
||||
|
|
@ -32,7 +32,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
person.email,
|
||||
conference.email_settings.confirmed_without_registration_subject,
|
||||
conference.email_settings.generate_event_mail(event, conference.email_settings.confirmed_email_template))
|
||||
conference.email_settings.generate_event_mail(event, conference.email_settings.confirmed_without_registration_body))
|
||||
end
|
||||
|
||||
def conference_date_update_mail(conference)
|
||||
|
|
@ -40,7 +40,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
user.email,
|
||||
conference.email_settings.updated_conference_dates_subject,
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.updated_conference_dates_template))
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.updated_conference_dates_body))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
user.email,
|
||||
conference.email_settings.updated_conference_registration_dates_subject,
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.updated_conference_registration_dates_template))
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.updated_conference_registration_dates_body))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
user.email,
|
||||
conference.email_settings.venue_update_subject,
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.venue_update_template))
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.venue_update_body))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
user.email,
|
||||
conference.email_settings.call_for_papers_schedule_public_subject,
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.call_for_papers_schedule_public_template))
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.call_for_papers_schedule_public_body))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class Mailbot < ActionMailer::Base
|
|||
build_email(conference,
|
||||
user.email,
|
||||
conference.email_settings.call_for_papers_dates_updates_subject,
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.call_for_papers_dates_updates_template))
|
||||
conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.call_for_papers_dates_updates_body))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class CallForPaper < ActiveRecord::Base
|
|||
&& (self.start_date_changed? || self.end_date_changed?)\
|
||||
&& self.conference.email_settings.send_on_call_for_papers_dates_updates\
|
||||
&& !self.conference.email_settings.call_for_papers_dates_updates_subject.blank?\
|
||||
&& !self.conference.email_settings.call_for_papers_dates_updates_template.blank?
|
||||
&& !self.conference.email_settings.call_for_papers_dates_updates_body.blank?
|
||||
end
|
||||
##
|
||||
# Checks whether cfp dates is updated
|
||||
|
|
@ -60,7 +60,7 @@ class CallForPaper < ActiveRecord::Base
|
|||
&& (self.start_date_changed? || self.end_date_changed?)\
|
||||
&& self.conference.email_settings.send_on_call_for_papers_dates_updates\
|
||||
&& !self.conference.email_settings.call_for_papers_dates_updates_subject.blank?\
|
||||
&& !self.conference.email_settings.call_for_papers_dates_updates_template.blank?
|
||||
&& !self.conference.email_settings.call_for_papers_dates_updates_body.blank?
|
||||
end
|
||||
|
||||
def remaining_days(date = Date.today)
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ class Conference < ActiveRecord::Base
|
|||
(self.start_date_changed? || self.end_date_changed?) &&
|
||||
self.email_settings.send_on_updated_conference_dates &&
|
||||
!self.email_settings.updated_conference_dates_subject.blank? &&
|
||||
self.email_settings.updated_conference_dates_template
|
||||
self.email_settings.updated_conference_dates_body
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -586,7 +586,7 @@ class Conference < ActiveRecord::Base
|
|||
(registration_period.start_date_changed? || registration_period.end_date_changed?) &&
|
||||
email_settings.send_on_updated_conference_registration_dates &&
|
||||
!email_settings.updated_conference_registration_dates_subject.blank? &&
|
||||
email_settings.updated_conference_registration_dates_template
|
||||
email_settings.updated_conference_registration_dates_body
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
class EmailSettings < ActiveRecord::Base
|
||||
attr_accessible :send_on_registration, :send_on_accepted, :send_on_rejected,
|
||||
:send_on_confirmed_without_registration, :registration_email_template,
|
||||
:accepted_email_template, :rejected_email_template, :confirmed_email_template,
|
||||
:registration_subject, :accepted_subject, :rejected_subject,
|
||||
:confirmed_without_registration_subject,
|
||||
:send_on_updated_conference_dates, :updated_conference_dates_subject,
|
||||
:updated_conference_dates_template, :send_on_updated_conference_registration_dates,
|
||||
:updated_conference_registration_dates_subject, :updated_conference_registration_dates_template,
|
||||
:send_on_venue_update, :venue_update_subject, :venue_update_template,
|
||||
:send_on_call_for_papers_dates_updates, :send_on_call_for_papers_schedule_public,
|
||||
:call_for_papers_schedule_public_subject, :call_for_papers_dates_updates_subject,
|
||||
:call_for_papers_schedule_public_template, :call_for_papers_dates_updates_template
|
||||
attr_accessible :send_on_registration, :registration_subject, :registration_body,
|
||||
:send_on_accepted, :accepted_subject, :accepted_body,
|
||||
:send_on_rejected, :rejected_subject, :rejected_body,
|
||||
:send_on_confirmed_without_registration, :confirmed_without_registration_subject, :confirmed_without_registration_body,
|
||||
:send_on_updated_conference_dates, :updated_conference_dates_subject, :updated_conference_dates_body,
|
||||
:send_on_updated_conference_registration_dates, :updated_conference_registration_dates_subject, :updated_conference_registration_dates_body,
|
||||
:send_on_venue_update, :venue_update_subject, :venue_update_body,
|
||||
:send_on_call_for_papers_dates_updates, :call_for_papers_dates_updates_subject, :call_for_papers_dates_updates_body,
|
||||
:send_on_call_for_papers_schedule_public, :call_for_papers_schedule_public_subject, :call_for_papers_schedule_public_body
|
||||
|
||||
def get_values(conference, user, event = nil)
|
||||
h = {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Event < ActiveRecord::Base
|
|||
|
||||
def process_confirmation
|
||||
if conference.email_settings.send_on_confirmed_without_registration? &&
|
||||
conference.email_settings.confirmed_email_template &&
|
||||
conference.email_settings.confirmed_without_registration_body &&
|
||||
conference.email_settings.confirmed_without_registration_subject
|
||||
if conference.registrations.where(user_id: submitter.id).first.nil?
|
||||
Mailbot.delay.confirm_reminder_mail(self)
|
||||
|
|
@ -122,7 +122,7 @@ class Event < ActiveRecord::Base
|
|||
|
||||
def process_acceptance(options)
|
||||
if conference.email_settings.send_on_accepted &&
|
||||
conference.email_settings.accepted_email_template &&
|
||||
conference.email_settings.accepted_body &&
|
||||
conference.email_settings.accepted_subject &&
|
||||
!options[:send_mail].blank?
|
||||
Rails.logger.debug 'Sending event acceptance mail'
|
||||
|
|
@ -132,7 +132,7 @@ class Event < ActiveRecord::Base
|
|||
|
||||
def process_rejection(options)
|
||||
if conference.email_settings.send_on_rejected &&
|
||||
conference.email_settings.rejected_email_template &&
|
||||
conference.email_settings.rejected_body &&
|
||||
conference.email_settings.rejected_subject &&
|
||||
!options[:send_mail].blank?
|
||||
Rails.logger.debug 'Sending rejected mail'
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Venue < ActiveRecord::Base
|
|||
(!self.name.blank? && !self.street.blank?) &&
|
||||
(conference.email_settings.send_on_venue_update &&
|
||||
!conference.email_settings.venue_update_subject.blank? &&
|
||||
conference.email_settings.venue_update_template)
|
||||
conference.email_settings.venue_update_body)
|
||||
end
|
||||
|
||||
# TODO: create a module to be mixed into model to perform same operation
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ User <%= @comment.user.name %> posted a new comment for event <%= @event.title %
|
|||
To reply to this comment, please go to <%= h( admin_conference_event_url(@conference.short_title, @event)) %>
|
||||
|
||||
Best wishes,
|
||||
<%= @conference.short_title %> Team
|
||||
<%= @conference.title %> Team
|
||||
|
|
|
|||
|
|
@ -19,68 +19,68 @@
|
|||
#onboarding.tab-pane.active{:role => "tabpanel"}
|
||||
= f.input :send_on_registration, label: "Send an email when the user registers for the conference?", :input_html => {"data-name"=>"email_settings_registration_subject", "class"=>"send_on_radio"}
|
||||
= f.input :registration_subject
|
||||
= f.input :registration_email_template, :input_html => { :rows => 10, :cols => 20}
|
||||
= f.input :registration_body, :input_html => { :rows => 10, :cols => 20}
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThank you for Registering for the conference {conference}.\nPlease complete your registration by filling out your travel information.\n\nIf you are unable to attend please unregister online:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\nWe look forward to see you there.\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_registration_email_template"} Load Template
|
||||
"data-name"=>"email_settings_registration_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"registration_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'registration_help', show_event_variables: false}
|
||||
#proposal.tab-pane{:role => "tabpanel"}
|
||||
= f.input :send_on_accepted, label: "Send an email when the proposal is accepted?", :input_html => {"data-name"=>"email_settings_accepted_subject", "class"=>"send_on_radio"}
|
||||
= f.input :accepted_subject
|
||||
= f.input :accepted_email_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :accepted_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name}\n\nWe are very pleased to inform you that your submission {eventtitle} has been accepted for the conference {conference}.\n\nThe public page of your submission can be found at:\n{proposalslink}\nIf you haven´t already registered for {conference}, please do as soon as possible:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_accepted_email_template"} Load Template
|
||||
"data-name"=>"email_settings_accepted_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"accepted_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'accepted_help', show_event_variables: true}
|
||||
= f.input :send_on_rejected, label: "Send an email when the proposal is rejected?", :input_html => {"data-name"=>"email_settings_rejected_subject", "class"=>"send_on_radio"}
|
||||
= f.input :rejected_subject
|
||||
= f.input :rejected_email_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :rejected_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThank you for your submission {eventtitle} for the conference {conference}.\nAfter careful consideration we are sorry to inform you that your submissionhas been rejected.\n\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_rejected_email_template"} Load Template
|
||||
"data-name"=>"email_settings_rejected_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"rejected_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'rejected_help', show_event_variables: true}
|
||||
= f.input :send_on_confirmed_without_registration, label: "Send an email when a user has a confirmed proposal, but isn't yet registered?", :input_html => {"data-name"=>"email_settings_confirmed_without_registration_subject", "class"=>"send_on_radio"}
|
||||
= f.input :confirmed_without_registration_subject
|
||||
= f.input :confirmed_email_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :confirmed_without_registration_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThank you for the confirmation of {eventtitle}. Unfortunately you are not registered for the conference {conference}. Please register as soon as possible:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_confirmed_email_template"} Load Template
|
||||
"data-name"=>"email_settings_confirmed_without_registration_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"confirmed_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'confirmed_help', show_event_variables: true}
|
||||
#notifications.tab-pane{:role => "tabpanel"}
|
||||
= f.input :send_on_updated_conference_dates, label: "This is to notify all participants that the conference dates has been changed.", :input_html => {"data-name"=>"email_settings_updated_conference_dates_subject", "class"=>"send_on_radio"}
|
||||
= f.input :updated_conference_dates_subject
|
||||
= f.input :updated_conference_dates_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :updated_conference_dates_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe date of {conference} has changed.\n New Dates : {conference_start_date} - {conference_end_date}.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_updated_conference_dates_template"} Load Template
|
||||
"data-name"=>"email_settings_updated_conference_dates_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_dates_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'updated_dates_help', show_event_variables: false}
|
||||
= f.input :send_on_updated_conference_registration_dates, label: "This is to notify all participants that the conference registration dates has been changed.", :input_html => {"data-name"=>"email_settings_updated_conference_registration_dates_subject", "class"=>"send_on_radio"}
|
||||
= f.input :updated_conference_registration_dates_subject
|
||||
= f.input :updated_conference_registration_dates_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :updated_conference_registration_dates_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe registration date of {conference} has changed.\n New Dates : {registration_start_date} - {registration_end_date}.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_updated_conference_registration_dates_template"} Load Template
|
||||
"data-name"=>"email_settings_updated_conference_registration_dates_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_registrations_dates_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'updated_registrations_dates_help', show_event_variables: false}
|
||||
= f.input :send_on_venue_update, label: 'Send an email on updating the Venue.', :input_html => {"data-name"=>"email_settings_venue_update_subject", "class"=>"send_on_radio"}
|
||||
= f.input :venue_update_subject
|
||||
= f.input :venue_update_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :venue_update_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference venue of {conference} has changed. New location is: {venue}.\n Address: {venue_address}.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_venue_update_template"} Load Template
|
||||
"data-name"=>"email_settings_venue_update_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_venue_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'updated_venue_help', show_event_variables: false}
|
||||
#cfp.tab-pane{:role => "tabpanel"}
|
||||
= f.input :send_on_call_for_papers_schedule_public, hint: "This will notify all participants when the dates are updated or when the schedule is made public"
|
||||
= f.input :call_for_papers_schedule_public_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public"
|
||||
= f.input :call_for_papers_schedule_public_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :call_for_papers_schedule_public_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference Call for Papers Details of {conference} has changed.The schedule is being made public.\n Link to Schedule {schedule_link} \n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_call_for_papers_schedule_public_template"} Load Template
|
||||
"data-name"=>"email_settings_call_for_papers_schedule_public_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false}
|
||||
= f.input :send_on_call_for_papers_dates_updates, hint: "This will notify all participants when the dates are updated or when the schedule is made public"
|
||||
= f.input :call_for_papers_dates_updates_subject, hint: "This subject will used whenever dates are updated or when the schedule is made public"
|
||||
= f.input :call_for_papers_dates_updates_template, :input_html => { :rows => 10, :cols => 20 }
|
||||
= f.input :call_for_papers_dates_updates_body, :input_html => { :rows => 10, :cols => 20 }
|
||||
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference Call for Papers Details of {conference} has changed.\nNew Dates : {cfp_start_date} - {cfp_end_date}.\n Link to Schedule {schedule_link} \n\nBest wishes\n\n{conference} Team",
|
||||
"data-name"=>"email_settings_call_for_papers_dates_updates_template"} Load Template
|
||||
"data-name"=>"email_settings_call_for_papers_dates_updates_body"} Load Template
|
||||
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help
|
||||
= render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false}
|
||||
.row
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue