diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 1f5a649..cfb4319 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -1,39 +1,41 @@ class NotificationMailer < ActionMailer::Base default from: WebDNS.settings[:mail_from] + ENVIRON_PREFIX = WebDNS.settings[:notifications_prefix] || 'webdns' + PREFIXES = { create: 'Created', update: 'Modified', destroy: 'Deleted', } def notify_record(record:, context:, user:, admin:, others:, changes:) @record = record @context = context @user = user @admin = admin @changes = changes - mail(to: others, subject: "[webdns] [record] #{PREFIXES[context.to_sym]} #{record.to_short_dns}") + mail(to: others, subject: "[#{ENVIRON_PREFIX}] [record] #{PREFIXES[context.to_sym]} #{record.to_short_dns}") end def notify_record_bulk(domain:, user:, admin:, others:, operations:) @domain = domain @user = user @admin = admin @operations = operations - mail(to: others, subject: "[webdns] [record] Bulk operations for '#{domain.name}'") + mail(to: others, subject: "[#{ENVIRON_PREFIX}] [record] Bulk operations for '#{domain.name}'") end def notify_domain(domain:, context:, user:, admin:, others:, changes:) @domain = domain @context = context @user = user @admin = admin @changes = changes - mail(to: others, subject: "[webdns] [domain] #{PREFIXES[context.to_sym]} #{domain.name}") + mail(to: others, subject: "[#{ENVIRON_PREFIX}] [domain] #{PREFIXES[context.to_sym]} #{domain.name}") end end