Class: NotificationMailers::AlsoCommented

Inherits:
Base
  • Object
show all
Defined in:
app/mailers/notification_mailers/also_commented.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#recipient, #sender

Instance Method Summary collapse

Methods inherited from Base

#headers, #initialize, #name_and_address

Constructor Details

This class inherits a constructor from NotificationMailers::Base

Instance Attribute Details

#commentObject

Returns the value of attribute comment


5
6
7
# File 'app/mailers/notification_mailers/also_commented.rb', line 5

def comment
  @comment
end

Instance Method Details

#mail?Boolean

Returns:

  • (Boolean)

21
22
23
# File 'app/mailers/notification_mailers/also_commented.rb', line 21

def mail?
  @recipient && @sender && @comment
end

#set_headers(comment_id) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/mailers/notification_mailers/also_commented.rb', line 8

def set_headers(comment_id)
  @comment = Comment.find_by_id(comment_id)

  if mail?
    @headers[:in_reply_to] = @headers[:references] = "<#{@comment.parent.guid}@#{AppConfig.pod_uri.host}>"
    if @comment.public?
      @headers[:subject] = "Re: #{@comment.comment_email_subject}"
    else
      @headers[:subject] = I18n.t("notifier.also_commented.limited_subject")
    end
  end
end