Compare commits
No commits in common. "main" and "smtp-settings" have entirely different histories.
main
...
smtp-setti
@ -22,13 +22,7 @@ class GuestsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
guest = Guest.find(params[:id])
|
guest = Guest.find(params[:id]).update!(guest_params)
|
||||||
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
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
# 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
|
|
@ -3,16 +3,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
class << self
|
default from: 'from@example.com'
|
||||||
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
|
||||||
|
@ -23,6 +23,5 @@ 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
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<%# 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>
|
|
@ -1,9 +0,0 @@
|
|||||||
<%# 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") %>
|
|
@ -79,8 +79,7 @@ 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
|
||||||
{}
|
{}
|
||||||
|
@ -1,19 +1,31 @@
|
|||||||
|
# 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."
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user