cirandas.net

ref: master

app/mailers/scrap_notifier.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class ScrapNotifier < ApplicationMailer

  def notification(scrap)
    sender, receiver = scrap.sender, scrap.receiver
    self.environment = sender.environment
    # for tests
    return unless receiver.email

    @recipient = receiver.name
    @sender = sender.name
    @sender_link = sender.url
    @scrap_content = scrap.content
    @wall_url = scrap.scrap_wall_url
    @url = sender.environment.top_url
    mail(
      to: receiver.email,
      from: "#{sender.environment.name} <#{sender.environment.noreply_email}>".html_safe,
      subject: _("[%s] You received a scrap!").html_safe % [sender.environment.name]
    )
  end
end