Class: Notification

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/notification.rb

Instance Method Summary collapse

Instance Method Details

#event(event, sid) ⇒ Object



28
29
30
31
# File 'app/mailers/notification.rb', line 28

def event(event, sid)
  @e = event
  mail :from=>isfrom(sid),:subject=>"Event #{event.id} occurred: #{event.name}",  :to => Preference.getCached(sid, 'notify:event')
end

#form_submission(submission_id, sid, recipient) ⇒ Object



33
34
35
36
37
38
# File 'app/mailers/notification.rb', line 33

def form_submission(submission_id,sid, recipient)
  @sub = FormSubmission.find(submission_id)
  @sid = sid
  mail :subject=>"#{Preference.getCached(sid,'app_name')} #{@sub.form.title} Submission",
         :to=>recipient, :from=>isfrom(sid)
end

#moderation_required(object_type, message, sid) ⇒ Object



40
41
42
43
44
45
46
47
# File 'app/mailers/notification.rb', line 40

def moderation_required(object_type, message,sid)
  type = object_type.urlise
  @message  = message
  @type = object_type
  notify = Preference.get_cached(sid,"notify_#{type}") || Preference.get_cached(sid,"notify")
    mail :subject=>"#{type} Requires Moderation",
          :to=>notify, :from=>isfrom(sid)
end

#new_post(post, to_user) ⇒ Object



15
16
17
18
19
20
21
# File 'app/mailers/notification.rb', line 15

def new_post(post, to_user)
  @sid = post.system_id
  @post = post
  @to_user = to_user

  mail :subject=>"#{Preference.get_cached(@sid, "site_name")}: New post on thread '#{truncate(post.topic_thread.title, :length=>80, :ommission=>'...')}'", :to=>@to_user.email, :from=>isfrom(@sid)
end

#report_post_admin(report, sid) ⇒ Object



6
7
8
9
10
11
12
13
# File 'app/mailers/notification.rb', line 6

def report_post_admin(report,sid)
  @post = report.topic_post

  @email = report.user.email
  @user = report.user.display_name
  @sid = sid
  mail(:from=>isfrom(sid), :to => Preference.getCached(sid, "report_post_notification"), :subject => "Reported Post")
end

#send_message(user_note, sid) ⇒ Object



49
50
51
52
53
# File 'app/mailers/notification.rb', line 49

def send_message(user_note, sid)
  @user_note = user_note
  @sid = sid
  mail :from=>isfrom(sid), :to=>user_note.user.email, :subject=>user_note.subject
end

#welcome_message(to, sid) ⇒ Object



23
24
25
26
# File 'app/mailers/notification.rb', line 23

def welcome_message(to, sid)
  @sid = sid
  mail(:from=>isfrom(sid), :to=>to.email, :subject=>"Thanks for joining")
end