diff --git a/app/jobs/user_archive_job.rb b/app/jobs/user_archive_job.rb index ca30af5c..06b27632 100644 --- a/app/jobs/user_archive_job.rb +++ b/app/jobs/user_archive_job.rb @@ -20,7 +20,7 @@ def create_global_archive_user User.create!(id: ARCHIVE_USER_ID, username: 'archived.user', - email: 'ict@csvalpha.nl', + email: Rails.application.config.x.ict_email, first_name: 'Gearchiveerde', last_name: 'Gebruiker', address: 'Onbekend', diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 529e5da1..7c76a405 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,4 @@ class ApplicationMailer < ActionMailer::Base - default from: 'no-reply@csvalpha.nl' + default from: Rails.application.config.x.noreply_email layout 'mailer' end diff --git a/app/mailers/mail_smtp_mailer.rb b/app/mailers/mail_smtp_mailer.rb index de9035ef..81643706 100644 --- a/app/mailers/mail_smtp_mailer.rb +++ b/app/mailers/mail_smtp_mailer.rb @@ -12,14 +12,14 @@ def enabled_email(mail_alias, password) # since we do not want to send the password to mail management def notify_management_enable_email(mail_alias) @mail_alias = mail_alias - mail to: 'mailbeheer@csvalpha.nl', + mail to: Rails.application.config.x.mailbeheer_email, subject: "SMTP account voor #{mail_alias.email} aangemaakt" end # Mail to notify the user and mail management that their SMTP is removed def disabled_email(mail_alias) @mail_alias = mail_alias - mail to: 'mailbeheer@csvalpha.nl', bcc: mail_alias.mail_addresses, + mail to: Rails.application.config.x.mailbeheer_email, bcc: mail_alias.mail_addresses, subject: "SMTP account voor #{mail_alias.email} opgeheven" end end diff --git a/app/mailers/user_cleanup_mailer.rb b/app/mailers/user_cleanup_mailer.rb index 54b29b37..c4dc77de 100644 --- a/app/mailers/user_cleanup_mailer.rb +++ b/app/mailers/user_cleanup_mailer.rb @@ -6,6 +6,6 @@ def cleanup_email(will_archive_users, archived_users) ' staan op het punt gearchiveerd te worden' subject = 'Er zijn gebruikers gearchiveerd!' if @will_archive_users.empty? - mail to: 'ict@csvalpha.nl;bestuur@csvalpha.nl', subject: + mail to: Rails.application.config.x.privacy_email, subject: end end diff --git a/app/mailers/user_export_mailer.rb b/app/mailers/user_export_mailer.rb index abed5cbd..9f1d53de 100644 --- a/app/mailers/user_export_mailer.rb +++ b/app/mailers/user_export_mailer.rb @@ -4,6 +4,7 @@ def privacy_notification_email(exporting_user, group, fields, description) @group = group @fields = fields @description = description - mail to: 'privacy@csvalpha.nl', subject: '[Privacy] Er is een database-export gemaakt' # rubocop:disable Rails/I18nLocaleTexts + mail to: Rails.application.config.x.privacy_email, + subject: '[Privacy] Er is een database-export gemaakt' # rubocop:disable Rails/I18nLocaleTexts end end diff --git a/app/views/mail_bounce_mailer/address_unknown.html.erb b/app/views/mail_bounce_mailer/address_unknown.html.erb index ab441ae7..c8e5e6e2 100644 --- a/app/views/mail_bounce_mailer/address_unknown.html.erb +++ b/app/views/mail_bounce_mailer/address_unknown.html.erb @@ -1,4 +1,4 @@ U heeft geprobeerd een mail te versturen naar een @csvalpha.nl mailadres. Deze kan helaas niet bezorgd worden. Het gebruikte mailadres <%= @to %> is namelijk niet in gebruik. Controleer het mailadres nogmaals.

-Mocht u zeker zijn dat het mailadres klopt of niet weten welk mailadres u moet gebruiken kunt u mailen naar abactis@csvalpha.nl +Mocht u zeker zijn dat het mailadres klopt of niet weten welk mailadres u moet gebruiken kunt u mailen naar <%= Rails.application.config.x.ict_email %> diff --git a/app/views/mail_bounce_mailer/mail_bounced.html.erb b/app/views/mail_bounce_mailer/mail_bounced.html.erb index e7b4ce67..daad768b 100644 --- a/app/views/mail_bounce_mailer/mail_bounced.html.erb +++ b/app/views/mail_bounce_mailer/mail_bounced.html.erb @@ -1,4 +1,5 @@ Uw bericht met als onderwerp "<%= @subject %>" aan "<%= @to %>" is helaas niet succesvol afgeleverd.
De reden hiervoor is: <%= @reason %>. Mocht dit een bericht aan een mailgroep zijn kan het ook zijn dat het bericht maar bij één ontvanger niet is aangekomen.

-Voor meer vragen kunt u mailen naar mailbeheer@csvalpha.nl +Voor meer vragen kunt u mailen naar <%= Rails.application.config.x.ict_email %> + diff --git a/app/views/user_cleanup_mailer/cleanup_email.erb b/app/views/user_cleanup_mailer/cleanup_email.erb index d1af789b..235c96e5 100644 --- a/app/views/user_cleanup_mailer/cleanup_email.erb +++ b/app/views/user_cleanup_mailer/cleanup_email.erb @@ -8,7 +8,7 @@ - <%= user.full_name %> <% end %>

- Vergeet niet de lidmaatschapsformulieren van deze leden te vernietigd. Als dit gebeurd is zouden we dan op de hoogte kunnen worden gebracht door middel van een mailtje naar privacy@csvalpha.nl. + Vergeet niet de lidmaatschapsformulieren van deze leden te vernietigd. Als dit gebeurd is zouden we dan op de hoogte kunnen worden gebracht door middel van een mailtje naar <%= Rails.application.config.x.privacy_email %>. <% end %>
diff --git a/config/application.rb b/config/application.rb index 18efd06c..7158b5ae 100644 --- a/config/application.rb +++ b/config/application.rb @@ -81,5 +81,10 @@ class Application < Rails::Application config.x.google_api_key = credentials.dig(Rails.env.to_sym, :google_api_key) config.x.healthcheck_ids = credentials.dig(Rails.env.to_sym, :healthcheck_ids) + + config.x.noreply_email = ENV.fetch('NOREPLY_EMAIL', 'no-reply@csvalpha.com') + config.x.ict_email = ENV.fetch('ICT_EMAIL', 'ict@csvalpha.com') + config.x.privacy_email = ENV.fetch('PRIVACY_EMAIL', 'privacy@csvalpha.com') + config.x.mailbeheer_email = ENV.fetch('PRIVACY_EMAIL', 'mailbeheer@csvalpha.com') end end diff --git a/db/migrate/20241027103012_create_study_room_presence.rb b/db/migrate/20241027103012_create_study_room_presence.rb index d7133dc2..1d385f8e 100644 --- a/db/migrate/20241027103012_create_study_room_presence.rb +++ b/db/migrate/20241027103012_create_study_room_presence.rb @@ -8,10 +8,10 @@ def change t.datetime :deleted_at t.timestamps end - end - Permission.create(name: 'study_room_presence.create') - Permission.create(name: 'study_room_presence.read') - Permission.create(name: 'study_room_presence.update') - Permission.create(name: 'study_room_presence.destroy') + Permission.find_or_create_by!(name: 'study_room_presence.create') + Permission.find_or_create_by!(name: 'study_room_presence.read') + Permission.find_or_create_by!(name: 'study_room_presence.update') + Permission.find_or_create_by!(name: 'study_room_presence.destroy') + end end diff --git a/db/schema.rb b/db/schema.rb index ce28ee93..1d334e5b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,6 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[7.0].define(version: 2024_11_13_104056) do + # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -484,7 +485,7 @@ t.index ["datetime"], name: "index_quickpost_messages_on_datetime" t.index ["deleted_at"], name: "index_quickpost_messages_on_deleted_at" end - + create_table "room_adverts", force: :cascade do |t| t.string "house_name", null: false t.string "contact", null: false diff --git a/spec/jobs/smtp_job_spec.rb b/spec/jobs/smtp_job_spec.rb index 247b798f..37867317 100644 --- a/spec/jobs/smtp_job_spec.rb +++ b/spec/jobs/smtp_job_spec.rb @@ -25,7 +25,7 @@ it { expect(mail.bcc).to eq mail_alias.mail_addresses } it { expect(mail.subject).to eq "Je kunt nu mail versturen vanaf #{mail_alias.email}!" } - it { expect(management_mail.to).to eq ['mailbeheer@csvalpha.nl'] } + it { expect(management_mail.to).to eq [Rails.application.config.x.mailbeheer_email] } it { expect(management_mail.subject).to eq "SMTP account voor #{mail_alias.email} aangemaakt" @@ -47,7 +47,7 @@ it { expect(client).to have_received(:delete_smtp) } it { expect(mail.bcc).to eq mail_alias.mail_addresses } - it { expect(mail.to).to eq ['mailbeheer@csvalpha.nl'] } + it { expect(mail.to).to eq [Rails.application.config.x.mailbeheer_email] } it { expect(mail.subject).to eq "SMTP account voor #{mail_alias.email} opgeheven" } end end diff --git a/spec/jobs/user_cleanup_job_spec.rb b/spec/jobs/user_cleanup_job_spec.rb index e86fd21f..97d49b68 100644 --- a/spec/jobs/user_cleanup_job_spec.rb +++ b/spec/jobs/user_cleanup_job_spec.rb @@ -35,8 +35,7 @@ context 'when with will archive and archived users' do it { expect(ActionMailer::Base.deliveries.count).to eq 1 } - it { expect(email.to).to include 'bestuur@csvalpha.nl' } - it { expect(email.to).to include 'ict@csvalpha.nl' } + it { expect(email.to).to include Rails.application.config.x.privacy_email } it { expect(email.body.to_s).to include(almost_archive_user.full_name) } it { expect(email.body.to_s).not_to include(user.full_name) } it { expect(email.body.to_s).to include('Er is 1 gebruiker gearchiveerd.') } diff --git a/spec/jobs/user_export_mailer_job_spec.rb b/spec/jobs/user_export_mailer_job_spec.rb index 908c9992..a82f6ecc 100644 --- a/spec/jobs/user_export_mailer_job_spec.rb +++ b/spec/jobs/user_export_mailer_job_spec.rb @@ -18,7 +18,7 @@ end it { expect(ActionMailer::Base.deliveries.count).to eq 1 } - it { expect(privacy_notification_email.to.first).to eq 'privacy@csvalpha.nl' } + it { expect(privacy_notification_email.to).to eq [Rails.application.config.x.privacy_email] } it { expect(privacy_notification_email.body.to_s).to include(exporting_user.full_name) } it { expect(privacy_notification_email.body.to_s).to include(group.name) } it { expect(privacy_notification_email.body.to_s).to include(fields.join(', ')) }