Class: NotificationMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/notification_mailer.rb

Instance Method Summary collapse

Instance Method Details

#build_messageObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/mailers/notification_mailer.rb', line 5

def build_message
  @user = params[:user]
  @work_activity = params[:work_activity]

  @subject = "[pdc-describe] New Notification"
  @message = @work_activity.message
  @message_html = @work_activity.to_html
  @url = work_url(@work_activity.work)

  # Troubleshooting https://github.com/pulibrary/pdc_describe/issues/1783
  if @url.include?("/describe/describe/")
    Rails.logger.error("URL #{@url} included /describe/describe/ and was fixed. See https://github.com/pulibrary/pdc_describe/issues/1783")
    @url = @url.gsub("/describe/describe/", "/describe/")
  end

  mail(to: @user.email, subject: @subject)
end