Compare commits

...

9 Commits

Author SHA1 Message Date
4496deeef5 Merge pull request 'Update FROM address for email delivery' (#292) from update-from into main
All checks were successful
Run unit tests / check-licenses (push) Has been skipped
Run unit tests / rubocop (push) Has been skipped
Run unit tests / copyright_notice (push) Has been skipped
Run unit tests / unit_tests (push) Successful in 2m53s
Run unit tests / build-static-assets (push) Successful in 10m20s
Reviewed-on: #292
2025-07-06 17:57:48 +00:00
de87b6c46b Merge pull request 'Enable TLS in email delivery' (#291) from tls-email into main
Some checks failed
Run unit tests / rubocop (push) Has been skipped
Run unit tests / copyright_notice (push) Has been skipped
Run unit tests / check-licenses (push) Has been skipped
Run unit tests / unit_tests (push) Successful in 2m42s
Run unit tests / build-static-assets (push) Has been cancelled
Reviewed-on: #291
2025-07-06 17:46:08 +00:00
eabba2109a Update FROM address for email delivery
All checks were successful
Run unit tests / check-licenses (pull_request) Successful in 35s
Run unit tests / copyright_notice (pull_request) Successful in 40s
Run unit tests / rubocop (pull_request) Successful in 1m10s
Run unit tests / unit_tests (pull_request) Successful in 1m47s
Run unit tests / build-static-assets (pull_request) Successful in 14m53s
2025-07-06 19:40:47 +02:00
1586f88986 Enable TLS in email delivery
All checks were successful
Run unit tests / rubocop (pull_request) Successful in 27s
Run unit tests / check-licenses (pull_request) Successful in 41s
Run unit tests / copyright_notice (pull_request) Successful in 45s
Run unit tests / unit_tests (pull_request) Successful in 1m14s
Run unit tests / build-static-assets (pull_request) Successful in 12m2s
2025-07-06 19:32:31 +02:00
c42eb4e576 Merge pull request 'Send email to organizers whenever a guest changes their attendance status' (#290) from status-change-email into main
All checks were successful
Run unit tests / rubocop (push) Has been skipped
Run unit tests / copyright_notice (push) Has been skipped
Run unit tests / check-licenses (push) Has been skipped
Run unit tests / unit_tests (push) Successful in 45s
Run unit tests / build-static-assets (push) Successful in 10m33s
Reviewed-on: #290
2025-07-06 16:53:49 +00:00
29b3fca80c Add copyright notice
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 1m25s
Run unit tests / rubocop (pull_request) Successful in 1m46s
Run unit tests / check-licenses (pull_request) Successful in 2m9s
Run unit tests / unit_tests (pull_request) Successful in 2m56s
Run unit tests / build-static-assets (pull_request) Successful in 18m42s
2025-07-06 16:32:02 +00:00
d236e459cd Send an email whenever an anonymous session updates the attendance status of a guest
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 29s
Run unit tests / rubocop (pull_request) Successful in 2m13s
Run unit tests / check-licenses (pull_request) Successful in 2m35s
Run unit tests / unit_tests (pull_request) Successful in 3m23s
Run unit tests / build-static-assets (pull_request) Successful in 18m43s
2025-07-06 18:30:35 +02:00
ff8918a1d4 Define a new email that will be sent to admins when a guest changes their attendance status 2025-07-06 18:11:08 +02:00
45313daba2 Merge pull request 'Configure SMTP settings' (#289) from smtp-settings into main
All checks were successful
Run unit tests / rubocop (push) Has been skipped
Run unit tests / copyright_notice (push) Has been skipped
Run unit tests / check-licenses (push) Has been skipped
Run unit tests / unit_tests (push) Successful in 55s
Run unit tests / build-static-assets (push) Successful in 11m9s
Reviewed-on: #289
2025-07-05 11:56:23 +00:00
8 changed files with 82 additions and 32 deletions

View File

@ -22,7 +22,13 @@ class GuestsController < ApplicationController
end end
def update def update
guest = Guest.find(params[:id]).update!(guest_params) guest = Guest.find(params[:id])
guest.update!(guest_params)
if !user_signed_in? && guest.saved_change_to_status?
AdminMailer.with(guest_id: guest.id).attendance_change_email.deliver_later
end
render json: guest.as_json(GUEST_PARAMS), status: :ok render json: guest.as_json(GUEST_PARAMS), status: :ok
end end

View File

@ -0,0 +1,18 @@
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
# frozen_string_literal: true
class AdminMailer < ApplicationMailer
def attendance_change_email
@guest = Guest.find(params[:guest_id])
mail(
to: @guest.wedding.users.pluck(:email),
subject: I18n.t(
'admin_mailer.attendance_change_email.subject',
name: @guest.name,
status: I18n.t("active_record.attributes.guest/status.#{@guest.status}")
)
)
end
end

View File

@ -3,6 +3,16 @@
# frozen_string_literal: true # frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com' class << self
private
def default_from
File.read('/run/secrets/smtp_user_name').strip
rescue Errno::ENOENT
'development@example.com'
end
end
default from: default_from
layout 'mailer' layout 'mailer'
end end

View File

@ -23,5 +23,6 @@ class Wedding < ApplicationRecord
has_many :guests, dependent: :delete_all has_many :guests, dependent: :delete_all
has_many :groups, dependent: :delete_all has_many :groups, dependent: :delete_all
has_many :invitations, dependent: :delete_all has_many :invitations, dependent: :delete_all
has_many :users, dependent: :delete_all
has_one :website, dependent: :destroy has_one :website, dependent: :destroy
end end

View File

@ -0,0 +1,17 @@
<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>
<p><%= I18n.t('admin_mailer.greeting') %>,</p>
<p>
<%= I18n.t('admin_mailer.attendance_change_email.paragraph_1', name: @guest.name) %>
</p>
<ul>
<li>
<strong><%= I18n.t("active_record.attributes.guest.status") %>:</strong> <%= I18n.t("active_record.attributes.guest/status.#{@guest.status}") %>
</li>
</ul>
<p>
<%= I18n.t("admin_mailer.attendance_change_email.notify_on_updates") %>
</p>

View File

@ -0,0 +1,9 @@
<%# Copyright (C) 2024-2025 LibreWeddingPlanner contributors %>
<%= I18n.t('admin_mailer.greeting') %>,
<%= I18n.t('admin_mailer.attendance_change_email.paragraph_1', name: @guest.name) %>
- <%= I18n.t("active_record.attributes.guest.status") %>: <%= I18n.t("active_record.attributes.guest/status.#{@guest.status}") %>
<%= I18n.t("admin_mailer.attendance_change_email.notify_on_updates") %>

View File

@ -79,7 +79,8 @@ Rails.application.configure do
port: File.read("/run/secrets/smtp_port").strip.to_i, port: File.read("/run/secrets/smtp_port").strip.to_i,
user_name: File.read("/run/secrets/smtp_user_name").strip, user_name: File.read("/run/secrets/smtp_user_name").strip,
password: File.read("/run/secrets/smtp_password").strip, password: File.read("/run/secrets/smtp_password").strip,
authentication: File.read("/run/secrets/smtp_authentication").strip.to_sym authentication: File.read("/run/secrets/smtp_authentication").strip.to_sym,
tls: true
} }
rescue Errno::ENOENT rescue Errno::ENOENT
{} {}

View File

@ -1,31 +1,19 @@
# Files in the config/locales directory are used for internationalization and
# are automatically loaded by Rails. If you want to use locales other than
# English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t "hello"
#
# In views, this is aliased to just `t`:
#
# <%= t("hello") %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more about the API, please read the Rails Internationalization guide
# at https://guides.rubyonrails.org/i18n.html.
#
# Be aware that YAML interprets the following case-insensitive strings as
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
# must be quoted to be interpreted as strings. For example:
#
# en:
# "yes": yup
# enabled: "ON"
en: en:
hello: "Hello world" hello: "Hello world"
active_record:
attributes:
guest:
status: Status
guest/status:
considered: Considered
invited: Invited
confirmed: Confirmed
declined: Declined
tentative: Tentative
admin_mailer:
greeting: "Dear user"
attendance_change_email:
subject: "%{name} has changed their attendance status: %{status}"
paragraph_1: "The guest %{name} has changed their attendance for the wedding."
notify_on_updates: "You will be notified of any further changes to their attendance status."