forked from publiclab/plots2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment_mailer.rb
57 lines (50 loc) · 1.73 KB
/
comment_mailer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class CommentMailer < ActionMailer::Base
helper :application
include ApplicationHelper
default from: "do-not-reply@#{ActionMailer::Base.default_url_options[:host]}"
# CommentMailer.notify_of_comment(user,self).deliver_now
def notify(user, comment)
@user = user
@comment = comment
@footer = feature('email-footer')
mail(to: user.email, subject: "New comment on #{comment.node.title} (##{comment.node.id}) ")
end
def notify_note_author(user, comment)
@user = user
@comment = comment
@footer = feature('email-footer')
mail(to: user.email, subject: "New comment on #{comment.node.title} (##{comment.node.id}) ")
end
# user is awarder, not awardee
def notify_barnstar(user, note)
@giver = user.drupal_user
@note = note
@footer = feature('email-footer')
mail(to: note.author.email, subject: 'You were awarded a Barnstar!')
end
def notify_callout(comment, user)
@user = user
@comment = comment
@footer = feature('email-footer')
mail(to: user.email, subject: 'You were mentioned in a comment. (##{comment.node.id})')
end
def notify_tag_followers(comment, user)
@user = user
@comment = comment
@footer = feature('email-footer')
mail(to: user.email, subject: 'A tag you follow was mentioned in a comment. (##{comment.node.id}) ')
end
def notify_answer_author(user, comment)
@user = user
@comment = comment
@footer = feature('email-footer')
mail(to: user.email, subject: "New comment on your answer on '" + comment.parent.title + "'")
end
def notify_coauthor(user, note)
@user = user
@note = note
@author = note.author
@footer = feature('email-footer')
mail(to: user.email, subject: 'You were added as a co-author!')
end
end