Class: UserNotifier

Inherits:
ActionMailer::Base
  • Object
show all
Extended by:
ActionView::Helpers::SanitizeHelper::ClassMethods
Includes:
ActionView::Helpers::SanitizeHelper, ActionView::Helpers::TextHelper, BaseHelper
Defined in:
app/models/user_notifier.rb

Instance Method Summary collapse

Methods included from BaseHelper

#add_friend_link, #ajax_spinner_for, #avatar_for, #block_to_partial, #box, #city_cloud, #clippings_link, #commentable_url, #container_title, #excerpt_with_jump, #flash_class, #forum_page?, #is_current_user_and_featured?, #jumbotron, #last_active, #more_comments_links, #page_title, #paginating_links, #possesive, #profile_completeness, #render_jumbotron, #render_widgets, #rounded, #search_posts_title, #search_user_posts_path, #show_footer_content?, #tag_auto_complete_field, #time_ago_in_words, #time_ago_in_words_or_date, #topnav_tab, #truncate_words, #truncate_words_with_highlight, #widget

Instance Method Details

#activation(user) ⇒ Object



109
110
111
112
113
114
# File 'app/models/user_notifier.rb', line 109

def activation(user)
  setup_email(user)
  @subject    += "#{:your_account_has_been_activated.l(:site => configatron.community_name)}"
  @url  = home_url
  mail(:to => @recipients, :subject => @subject)    
end

#comment_notice(comment) ⇒ Object



39
40
41
42
43
44
45
46
# File 'app/models/user_notifier.rb', line 39

def comment_notice(comment)
  setup_email(comment.recipient)
  @subject     += "#{:has_something_to_say_to_you_on.l(:user => comment.username, :site => configatron.community_name)}"
  @url  = commentable_url(comment)
  @comment = comment
  @commenter = comment.user
  mail(:to => @recipients, :subject => @subject)    
end

#follow_up_comment_notice(user, comment) ⇒ Object



48
49
50
51
52
53
54
55
# File 'app/models/user_notifier.rb', line 48

def follow_up_comment_notice(user, comment)
  setup_email(user)
  @subject     += "#{:has_commented_on_something_that_you_also_commented_on.l(:user => comment.username, :item => comment.commentable_type)}"
  @url  = commentable_url(comment)
  @comment = comment
  @commenter = comment.user
  mail(:to => @recipients, :subject => @subject)    
end

#follow_up_comment_notice_anonymous(email, comment) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/models/user_notifier.rb', line 57

def follow_up_comment_notice_anonymous(email, comment)
  @recipients  = "#{email}"

  @subject     = "[#{configatron.community_name}] "
  @sent_on     = Time.now
  @subject     += "#{:has_commented_on_something_that_you_also_commented_on.l(:user => comment.username, :item => comment.commentable_type)}"
  @url  = commentable_url(comment)
  @comment = comment

  @unsubscribe_link = url_for(:controller => 'comments', :action => 'unsubscribe', :commentable_type => comment.commentable_type, :commentable_id => comment.commentable_id, :id => comment.id, :token => comment.token_for(email), :email => email)
  mail(:to => @recipients, :subject => @subject)    
end

#forgot_username(user) ⇒ Object



124
125
126
127
128
# File 'app/models/user_notifier.rb', line 124

def forgot_username(user)
  setup_email(user)
  @subject    += "#{:user_information.l(:site => configatron.community_name)}"
  mail(:to => @recipients, :subject => @subject)    
end

#friendship_accepted(friendship) ⇒ Object



30
31
32
33
34
35
36
37
# File 'app/models/user_notifier.rb', line 30

def friendship_accepted(friendship)
  setup_email(friendship.user) 
  @subject     += "#{:friendship_request_accepted.l}"
  @requester = friendship.user
  @friend    = friendship.friend
  @url       = user_url(friendship.friend)
  mail(:to => @recipients, :subject => @subject)    
end

#friendship_request(friendship) ⇒ Object



22
23
24
25
26
27
28
# File 'app/models/user_notifier.rb', line 22

def friendship_request(friendship)
  setup_email(friendship.friend)
  @subject     += "#{:would_like_to_be_friends_with_you_on.l(:user => friendship.user., :site => configatron.community_name)}"
  @url  = pending_user_friendships_url(friendship.friend)
  @requester = friendship.user
  mail(:to => @recipients, :subject => @subject)    
end

#message_notification(message) ⇒ Object



86
87
88
89
90
91
# File 'app/models/user_notifier.rb', line 86

def message_notification(message)
  setup_email(message.recipient)
  @subject     += "#{:sent_you_a_private_message.l(:user => message.sender.)}"
  @message = message
  mail(:to => @recipients, :subject => @subject)    
end

#new_forum_post_notice(user, post) ⇒ Object



70
71
72
73
74
75
76
77
# File 'app/models/user_notifier.rb', line 70

def new_forum_post_notice(user, post)
  setup_email(user)
  @subject     += "#{:has_posted_in_a_thread_you_are_monitoring.l(:user => post.username)}"
  @url  = "#{forum_topic_url(:forum_id => post.topic.forum, :id => post.topic, :page => post.topic.last_page)}##{post.dom_id}"
  @post = post
  @author = post.username
  mail(:to => @recipients, :subject => @subject)     
end

#password_reset_instructions(user) ⇒ Object



116
117
118
119
120
121
122
# File 'app/models/user_notifier.rb', line 116

def password_reset_instructions(user)
  setup_email(user)
  @subject    += "#{:user_information.l(:site => configatron.community_name)}"
  @edit_password_reset_url = edit_password_reset_url(user.perishable_token)    
  
  mail(:to => @recipients, :subject => @subject)    
end

#post_recommendation(name, email, post, message = nil, current_user = nil) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'app/models/user_notifier.rb', line 94

def post_recommendation(name, email, post, message = nil, current_user = nil)
  @recipients  = "#{email}"
  @sent_on     = Time.now

  @subject     = "#{:check_out_this_story_on.l(:site => configatron.community_name)}"
  @name = name  
  @title  = post.title
  @post = post
  @signup_link = (current_user ?  (current_user, current_user.invite_code) :  )
  @message  = message
  @url  = user_post_url(post.user, post)
  @description = truncate_words(post.post, 100, @url )     
  mail(:to => @recipients, :subject => @subject)    
end

#signup_invitation(email, user, message) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/user_notifier.rb', line 10

def (email, user, message)

  @recipients  = "#{email}"
  @subject     = "#{:would_like_you_to_join.l(:user => user., :site => configatron.community_name)}"
  @sent_on     = Time.now
  @user = user
  @url  = (user, user.invite_code)
  @message = message

  mail(:to => @recipients, :subject => @subject)    
end

#signup_notification(user) ⇒ Object



79
80
81
82
83
84
# File 'app/models/user_notifier.rb', line 79

def (user)
  setup_email(user)        
  @subject    += "#{:please_activate_your_new_account.l(:site => configatron.community_name)}"
  @url  = "#{home_url}users/#{user.activation_code}/activate"
  mail(:to => @recipients, :subject => @subject)
end