Removes dulplicate conference update action and moves methods out of private area

This commit is contained in:
Chrisbr 2014-08-15 16:06:02 +02:00
parent 71bf793cdf
commit d0e9805456
3 changed files with 35 additions and 55 deletions

View file

@ -519,6 +519,32 @@ class Conference < ActiveRecord::Base
end
end
##
# Checks if conference is updated for email notifications.
#
# ====Returns
# * +True+ -> If conference is updated and all other parameters are set
# * +False+ -> Either conference is not updated or one or more parameter is not set
def notify_on_dates_change?
(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
end
##
# Checks if registration dates are updated for email notifications.
#
# ====Returns
# * +True+ -> If registration dates is updated and all other parameters are set
# * +False+ -> Either registration date is not updated or one or more parameter is not set
def notify_on_registration_dates_changed?
(self.registration_start_date_changed? || self.registration_end_date_changed?)\
&& self.email_settings.send_on_updated_conference_registration_dates\
&& !self.email_settings.updated_conference_registration_dates_subject.blank?\
&& self.email_settings.updated_conference_registration_dates_template
end
private
after_create do
@ -933,30 +959,4 @@ class Conference < ActiveRecord::Base
result
end
##
# Checks if conference is updated for email notifications.
#
# ====Returns
# * +True+ -> If conference is updated and all other parameters are set
# * +False+ -> Either conference is not updated or one or more parameter is not set
def notify_on_conf_dates_updates?
(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
end
##
# Checks if registration dates are updated for email notifications.
#
# ====Returns
# * +True+ -> If registration dates is updated and all other parameters are set
# * +False+ -> Either registration date is not updated or one or more parameter is not set
def notify_on_reg_dates?
(self.registration_start_date_changed? || self.registration_end_date_changed?)\
&& self.email_settings.send_on_updated_conference_registration_dates\
&& !self.email_settings.updated_conference_registration_dates_subject.blank?\
&& self.email_settings.updated_conference_registration_dates_template
end
end