mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-02 01:45:38 +08:00
Additional fixes to email markup and logic [SCI-443]
This commit is contained in:
parent
3f219e1bfe
commit
90c853743c
4 changed files with 18 additions and 8 deletions
|
@ -16,8 +16,10 @@ class AppMailer < Devise::Mailer
|
|||
def notification(user, notification)
|
||||
@user = user
|
||||
@notification = notification
|
||||
headers = { to: @user.email,
|
||||
subject: "#{I18n.t('notifications.email_title')} - #{notification.title}" }
|
||||
headers = {
|
||||
to: @user.email,
|
||||
subject: I18n.t('notifications.email_title')
|
||||
}
|
||||
mail(headers)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,11 +31,19 @@ class UserNotification < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_email
|
||||
if notification.type_of == 'system_message'
|
||||
send_email_notification(user, notification)
|
||||
elsif user.assignments_notification_email ||
|
||||
user.recent_notification_email
|
||||
case notification.type_of
|
||||
when 'system_message'
|
||||
send_email_notification(user, notification)
|
||||
when 'assignment'
|
||||
send_email_notification(
|
||||
user,
|
||||
notification
|
||||
) if user.assignments_notification_email
|
||||
when 'recent_changes'
|
||||
send_email_notification(
|
||||
user,
|
||||
notification
|
||||
) if user.recent_notification_email
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<p>Hello <%= @user.name %>!</p>
|
||||
|
||||
<p>You got new notification!</p>
|
||||
<p><%= I18n.t("notifications.email_title") %></p>
|
||||
|
||||
<p>Type: <%= I18n.t("notifications.types.#{@notification.type_of}") %></p>
|
||||
|
||||
|
|
|
@ -1523,7 +1523,7 @@ en:
|
|||
assignment: "Assignment"
|
||||
recent_changes: "Recent changes"
|
||||
system_message: "sciNote system message"
|
||||
email_title: "sciNote notification"
|
||||
email_title: "You've received a sciNote notification!"
|
||||
# This section contains general words that can be used in any parts of
|
||||
# application.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue