diff --git a/app/controllers/admin/emails_controller.rb b/app/controllers/admin/emails_controller.rb index ba456efe..c31dea0d 100644 --- a/app/controllers/admin/emails_controller.rb +++ b/app/controllers/admin/emails_controller.rb @@ -29,6 +29,7 @@ module Admin :send_on_accepted, :send_on_rejected, :send_on_confirmed_without_registration, :send_on_submitted_proposal, :submitted_proposal_subject, :submitted_proposal_body, + :send_on_event_comment, :registration_subject, :accepted_subject, :rejected_subject, :confirmed_without_registration_subject, :registration_body, :accepted_body, :rejected_body, :confirmed_without_registration_body, :send_on_conference_dates_updated, :conference_dates_updated_subject, :conference_dates_updated_body, diff --git a/app/models/comment.rb b/app/models/comment.rb index 9cc0007f..abaf89a9 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -63,7 +63,13 @@ class Comment < ApplicationRecord private + def conference + commentable.program.conference + end + def send_notification + return unless conference.email_settings.send_on_event_comment? + EventCommentMailJob.perform_later(self) end end diff --git a/app/views/admin/emails/index.html.haml b/app/views/admin/emails/index.html.haml index 41a43825..03b97e0b 100644 --- a/app/views/admin/emails/index.html.haml +++ b/app/views/admin/emails/index.html.haml @@ -35,6 +35,10 @@ %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' } + .checkbox + %label + = f.check_box :send_on_event_comment + Send an email to all organizers and CfP team members when a comment is added? .checkbox %label = f.check_box :send_on_submitted_proposal, data: { name: 'email_settings_proposal_submited_subject'}, class: 'send_on_radio' diff --git a/db/migrate/20220401000955_add_send_on_event_comment_to_email_settings.rb b/db/migrate/20220401000955_add_send_on_event_comment_to_email_settings.rb new file mode 100644 index 00000000..8f5a9f3e --- /dev/null +++ b/db/migrate/20220401000955_add_send_on_event_comment_to_email_settings.rb @@ -0,0 +1,5 @@ +class AddSendOnEventCommentToEmailSettings < ActiveRecord::Migration[7.0] + def change + add_column :email_settings, :send_on_event_comment, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 2ad25c7e..b0e19bf3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20181229233811) do +ActiveRecord::Schema.define(version: 2022_04_01_000955) do create_table "answers", force: :cascade do |t| t.string "title" @@ -192,6 +192,7 @@ ActiveRecord::Schema.define(version: 20181229233811) do t.boolean "send_on_submitted_proposal", default: false t.string "submitted_proposal_subject" t.text "submitted_proposal_body" + t.boolean "send_on_event_comment", default: true end create_table "event_schedules", force: :cascade do |t|