diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index bbd075095..88e243f8a 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -187,7 +187,7 @@ def search def allowed_params [ - :acronym, :allowed_event_types_extras, :attachment_title_is_freeform, + :acronym, :allowed_event_types_extras, :attachment_title_is_freeform, :bcc_address, :bulk_notification_enabled, :color, :default_recording_license, :default_timeslots, :email, :event_state_visible, :expenses_enabled, :feedback_enabled, :max_timeslots, :program_export_base_url, :schedule_custom_css, :schedule_html_intro, :schedule_public, :schedule_open, :schedule_version, :ticket_type, diff --git a/app/mailers/selection_notification.rb b/app/mailers/selection_notification.rb index a6db44357..0c4a72bab 100644 --- a/app/mailers/selection_notification.rb +++ b/app/mailers/selection_notification.rb @@ -9,6 +9,7 @@ def make_notification(event_person, field) mail( reply_to: conference.email, to: event_person.person.email, + bcc: conference.bcc_address, subject: event_person.substitute_notification_variables(field, :subject), locale: @locale, title: conference.title diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 691cc8a9d..471a54049 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -18,10 +18,12 @@ def bulk_mail_multiple_roles(event_people, template) persons=event_people.pluck(:person_id).uniq raise "this function should be used for one person only" unless persons.count == 1 person=Person.find(persons.first) + + bcc = template.conference.bcc_address msgs=event_people.map{|event_person| template.message_text_for_event_person(event_person)} msgs.uniq.each do |msg| - mail to: person.email, subject: msg[:subject], body: msg[:body] + mail to: person.email, subject: msg[:subject], body: msg[:body], bcc: bcc end end end diff --git a/app/views/conferences/_form.html.haml b/app/views/conferences/_form.html.haml index 6f9928700..cd75119c9 100644 --- a/app/views/conferences/_form.html.haml +++ b/app/views/conferences/_form.html.haml @@ -16,6 +16,7 @@ = f.input :title, hint: t('conferences_module.inputs.hints.title') = f.input :acronym, hint: t('conferences_module.inputs.hints.acronym') = f.input :email, hint: t('conferences_module.inputs.hints.email') + = f.input :bcc_address, hint: t('conferences_module.inputs.hints.bcc_address') = f.input :color, hint: t('conferences_module.inputs.hints.color'), input_html: { class: 'color' } -if @conference.main_conference? %fieldset.inputs diff --git a/config/locales/de.yml b/config/locales/de.yml index 6d4ac2f75..06fe45e2c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -31,6 +31,7 @@ de: acronym: Kürzel allowed_event_types_as_list: Zulässige Ereignistypen attachment_title_is_freeform: Der Titel des Anhangs ist Freiform + bcc_address: BCC-Adresse bulk_notification_enabled: Massen-Mailings color: Farbe default_recording_license: Standard-Aufnahmelizenz @@ -479,6 +480,10 @@ de: Wenn diese Option ausgewählt ist, können Einreicher einen beliebigen Titel angeben für Dateien laden sie als Anhänge hoch. Wenn diese Option deaktiviert ist, werden sie muss zwischen einer Reihe vorkonfigurierter Titel wählen. + bcc_address: | + Hier können Sie eine E-Mail-Adresse angeben. frab wird diese Adresse senden a + Kopie jeder E-Mail, die an die Einsender gesendet wird. Sie können dies als eine Möglichkeit verwenden, um zu behalten + ein Protokoll aller gesendeten E-Mails. bulk_notification_enabled: | Wenn aktiviert, werden die Einreicher über angenommene oder abgelehnte Events nicht sofort informiert, sondern gesammelt in Massen-Mailings über das eingebaute E-Mail-System oder einen diff --git a/config/locales/en.yml b/config/locales/en.yml index 8c77a1c7b..82c33bc16 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,6 +24,7 @@ en: acronym: Acronym allowed_event_types_as_list: Allowed event types attachment_title_is_freeform: Attachment title is freeform + bcc_address: BCC address bulk_notification_enabled: Bulk notifications color: Color default_recording_license: Default recording license @@ -452,6 +453,10 @@ en: If this option is selected, submitters can provide any title they want for files they upload as attachments. If this option is deselected, they must select between a set of pre-configured titles. + bcc_address: | + You can specify an e-mail address here. frab will send this address a + copy of each mail it sends to submitters. You can use this as a way to keep + a log of all e-mails sent. bulk_notification_enabled: | If you enable this, notifications will be sent out in bulk by mail or ticket subsystem. diff --git a/config/locales/es.yml b/config/locales/es.yml index b1fd84ce1..8bbbd6962 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -31,6 +31,7 @@ es: acronym: Abreviación allowed_event_types_as_list: Tipos de eventos permitidos attachment_title_is_freeform: El título del archivo adjunto es de forma libre + bcc_address: Dirección BCC bulk_notification_enabled: Notificaciones masivas color: Color default_recording_license: Licencia de grabación predeterminada @@ -497,6 +498,10 @@ es: Si se selecciona esta opción, los remitentes pueden proporcionar el título que deseen. para los archivos que cargan como archivos adjuntos. Si esta opción no está seleccionada, debe seleccionar entre un conjunto de títulos preconfigurados. + bcc_address: | + Puede especificar una dirección de correo electrónico aquí. frab enviará a esta dirección un + copia de cada correo que envía a los remitentes. Puede usar esto como una forma de mantener + un registro de todos los correos electrónicos enviados. bulk_notification_enabled: | Si habilita esto, las notificaciones se enviarán a granel por correo o subsistema de boletos. diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e7a55ede5..3f2865c98 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -24,6 +24,7 @@ fr: acronym: Acronyme allowed_event_types_as_list: Types d'événements autorisés attachment_title_is_freeform: Le titre de la pièce jointe est de forme libre + bcc_address: Adresse BCC bulk_notification_enabled: Notifications de groupe color: Couleur default_recording_license: License d’enregistrement par défaut @@ -455,6 +456,10 @@ fr: Si cette option est sélectionnée, les émetteurs peuvent fournir le titre de leur choix. pour les fichiers téléchargés en pièces jointes. Si cette option est désélectionnée, ils doit choisir entre un ensemble de titres préconfigurés. + bcc_address: | + Vous pouvez spécifier une adresse e-mail ici. frab enverra à cette adresse un + copie de chaque courrier qu'il envoie aux soumissionnaires. Vous pouvez l'utiliser pour garder + un journal de tous les e-mails envoyés. bulk_notification_enabled: | Si vous activez cette option, les notifications seront envoyées en masse par mail, ou par un sous-systeme de tickets. diff --git a/config/locales/it.yml b/config/locales/it.yml index c559579e4..03bbce342 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -24,6 +24,7 @@ it: acronym: acronimo allowed_event_types_as_list: Tipi di eventi consentiti attachment_title_is_freeform: Il titolo dell'allegato è a mano libera + bcc_address: Indirizzo BCC bulk_notification_enabled: Notifiche di gruppo color: colore default_recording_license: Licenza di registrazione predefinita @@ -455,6 +456,10 @@ it: Se questa opzione è selezionata, i mittenti possono fornire qualsiasi titolo desiderino per i file caricati come allegati. Se questa opzione è deselezionata, essi deve selezionare tra un set di titoli preconfigurati. + bcc_address: | + Puoi specificare un indirizzo e-mail qui. frab invierà questo indirizzo a + copia di ogni mail che invia ai mittenti. Puoi usarlo come un modo per conservare + un registro di tutte le e-mail inviate. bulk_notification_enabled: | Se abiliti questa opzione, le notifiche verranno inviate massa per posta, o da un sottosistema di biglietti. diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 246a782c5..4688fbe30 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -31,6 +31,7 @@ pt-BR: acronym: Acrônimo allowed_event_types_as_list: Tipos de eventos permitidos attachment_title_is_freeform: O título do anexo é de forma livre + bcc_address: Endereço BCC bulk_notification_enabled: Notificações em massa color: Cor default_recording_license: Licença de gravação padrão @@ -474,6 +475,10 @@ pt-BR: Se essa opção for selecionada, os remetentes poderão fornecer o título que quiserem. para arquivos que eles carregam como anexos. Se esta opção estiver desmarcada, eles deve selecionar entre um conjunto de títulos pré-configurados. + bcc_address: | + Você pode especificar um endereço de e-mail aqui. frab enviará a este endereço um + cópia de cada correspondência enviada aos remetentes. Você pode usar isso como uma forma de manter + um registro de todos os e-mails enviados. bulk_notification_enabled: | Se você ativar isso, as notificações serão enviadas em massa por e-mail ou subsistema de ticket. diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 6c407d674..76f171cbc 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -24,6 +24,7 @@ ru: acronym: Акроним allowed_event_types_as_list: Разрешенные типы событий attachment_title_is_freeform: Название вложения - произвольная + bcc_address: Адрес BCC bulk_notification_enabled: Включены массовые уведомления color: цвет default_recording_license: Лицензия на запись по умолчанию @@ -452,6 +453,10 @@ ru: Если эта опция выбрана, отправители могут предоставить любой заголовок, который они хотят для файлов, которые они загружают как вложения. Если этот параметр не выбран, они необходимо выбрать между набором предварительно настроенных заголовков. + bcc_address: | + Здесь вы можете указать адрес электронной почты. frab отправит на этот адрес + копию каждого письма, отправляемого отправителям. Вы можете использовать это как способ сохранить + журнал всех отправленных писем. bulk_notification_enabled: | Если вы включите это, уведомления будут отправлены массово по почте или подсистемы билета. diff --git a/config/locales/zh.yml b/config/locales/zh.yml index c652e2b8a..54db6446e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -24,6 +24,7 @@ zh: acronym: 缩写 allowed_event_types_as_list: 允许的事件类型 attachment_title_is_freeform: 附件标题为自由格式 + bcc_address: 密件抄送地址 bulk_notification_enabled: 批量通知已启用 color: 颜色 default_recording_license: 默认录制许可证 @@ -452,6 +453,10 @@ zh: 如果选择此选项,提交者可以提供他们想要的任何标题 他们以附件形式上传的文件。如果取消选择此选项,则它们 必须在一组预配置的标题之间进行选择。 + bcc_address: | + 您可以在此处指定一个电子邮件地址。 Frab会将此地址发送给 + 发送给提交者的每封邮件的副本。您可以使用它来保持 + 所有已发送电子邮件的日志。 bulk_notification_enabled: | 如果您启用此功能,通知将通过邮件批量发送 或票子系统。 diff --git a/db/migrate/20201114165533_add_bcc_address_to_conferences.rb b/db/migrate/20201114165533_add_bcc_address_to_conferences.rb new file mode 100644 index 000000000..d9d692a3b --- /dev/null +++ b/db/migrate/20201114165533_add_bcc_address_to_conferences.rb @@ -0,0 +1,5 @@ +class AddBccAddressToConferences < ActiveRecord::Migration[5.2] + def change + add_column :conferences, :bcc_address, :string, limit: 255 + end +end diff --git a/db/schema.rb b/db/schema.rb index c65be2854..ecda12660 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: 2020_09_18_000000) do +ActiveRecord::Schema.define(version: 2020_11_14_165533) do create_table "availabilities", force: :cascade do |t| t.integer "person_id" @@ -111,6 +111,7 @@ t.boolean "attachment_title_is_freeform", default: true t.string "allowed_event_types", default: "lecture;workshop;podium;lightning_talk;meeting;film;concert;djset;performance;other" t.string "allowed_event_timeslots_csv", limit: 400 + t.string "bcc_address", limit: 255 t.index ["acronym"], name: "index_conferences_on_acronym" t.index ["parent_id"], name: "index_conferences_on_parent_id" end diff --git a/lib/tasks/fake_data.rake b/lib/tasks/fake_data.rake index fdc8b1442..70aa9dd0d 100644 --- a/lib/tasks/fake_data.rake +++ b/lib/tasks/fake_data.rake @@ -9,6 +9,10 @@ namespace :frab do email: Faker::Internet.email, color: Faker::Color.hex_color[1..6]) + if rand(10) < 5 + conference.bcc_address = Faker::Internet.email + end + date = Faker::Time.forward(days: 23).beginning_of_day + 9.hours 3.times do diff --git a/test/features/filter_and_send_mail_test.rb b/test/features/filter_and_send_mail_test.rb index cc4a2f3f7..d82447356 100644 --- a/test/features/filter_and_send_mail_test.rb +++ b/test/features/filter_and_send_mail_test.rb @@ -1,9 +1,11 @@ require 'test_helper' class FilterAndSendMailTest < FeatureTest + BCC_ADDRESS = "jimmy@example.com" setup do ActionMailer::Base.deliveries = [] @conference = create(:three_day_conference_with_events_and_speakers) + @conference.update(bcc_address: BCC_ADDRESS) @event = @conference.events.last @admin = create(:admin_user) end @@ -48,6 +50,7 @@ class FilterAndSendMailTest < FeatureTest assert m.subject == "mail regarding #{@event.title}" assert m.body.include? "come to #{@event.room.name} please" assert m.body.include? "duration 01:00" + assert m.bcc.include? BCC_ADDRESS end end