Skip to content

Commit

Permalink
send BCC
Browse files Browse the repository at this point in the history
Conference crew can add a BCC address to a conference. E-mails sent by frab system to submitters will be send in BCC to that address.

Closes #656
  • Loading branch information
elad-eyal committed Nov 14, 2020
1 parent 9acb723 commit bb5f50e
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/conferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions app/mailers/selection_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions app/views/conferences/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: Лицензия на запись по умолчанию
Expand Down Expand Up @@ -452,6 +453,10 @@ ru:
Если эта опция выбрана, отправители могут предоставить любой заголовок, который они хотят
для файлов, которые они загружают как вложения. Если этот параметр не выбран, они
необходимо выбрать между набором предварительно настроенных заголовков.
bcc_address: |
Здесь вы можете указать адрес электронной почты. frab отправит на этот адрес
копию каждого письма, отправляемого отправителям. Вы можете использовать это как способ сохранить
журнал всех отправленных писем.
bulk_notification_enabled: |
Если вы включите это, уведомления будут отправлены массово по почте
или подсистемы билета.
Expand Down
5 changes: 5 additions & 0 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ zh:
acronym: 缩写
allowed_event_types_as_list: 允许的事件类型
attachment_title_is_freeform: 附件标题为自由格式
bcc_address: 密件抄送地址
bulk_notification_enabled: 批量通知已启用
color: 颜色
default_recording_license: 默认录制许可证
Expand Down Expand Up @@ -452,6 +453,10 @@ zh:
如果选择此选项,提交者可以提供他们想要的任何标题
他们以附件形式上传的文件。如果取消选择此选项,则它们
必须在一组预配置的标题之间进行选择。
bcc_address: |
您可以在此处指定一个电子邮件地址。 Frab会将此地址发送给
发送给提交者的每封邮件的副本。您可以使用它来保持
所有已发送电子邮件的日志。
bulk_notification_enabled: |
如果您启用此功能,通知将通过邮件批量发送
或票子系统。
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20201114165533_add_bcc_address_to_conferences.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddBccAddressToConferences < ActiveRecord::Migration[5.2]
def change
add_column :conferences, :bcc_address, :string, limit: 255
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/tasks/fake_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/features/filter_and_send_mail_test.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

0 comments on commit bb5f50e

Please sign in to comment.