]> git.openstreetmap.org Git - rails.git/blob - app/models/notifier.rb
Improving friend capabilities so you can now add and remove friends as you wish....
[rails.git] / app / models / notifier.rb
1 class Notifier < ActionMailer::Base
2
3   def signup_confirm( user, token )
4     @recipients = user.email
5     @from = 'abuse@openstreetmap.org'
6     @subject = '[OpenStreetMap] Confirm your email address'
7     @body['url'] = "http://#{SERVER_URL}/user/confirm?confirm_string=#{token.token}"
8   end
9
10   def lost_password( user, token )
11     @recipients = user.email
12     @from = 'abuse@openstreetmap.org'
13     @subject = '[OpenStreetMap] Password reset request'
14     @body['url'] = "http://#{SERVER_URL}/user/reset_password?email=#{user.email}&token=#{token.token}"
15   end
16
17   def reset_password(user, pass)
18     @recipients = user.email
19     @from = 'abuse@openstreetmap.org'
20     @subject = '[OpenStreetMap] Password reset'
21     @body['pass'] = pass
22   end
23
24   def gpx_success(trace, possible_points)
25     @recipients = trace.user.email
26     @from = 'abuse@openstreetmap.org'
27     @subject = '[OpenStreetMap] GPX Import success'
28     @body['trace_name'] = trace.name
29     @body['trace_points'] = trace.size
30     @body['possible_points'] = possible_points
31   end
32
33   def gpx_failure(trace, error)
34     @recipients = trace.user.email
35     @from = 'abuse@openstreetmap.org'
36     @subject = '[OpenStreetMap] GPX Import failure'
37     @body['trace_name'] = trace.name
38     @body['error'] = error
39   end
40   
41   def message_notification(message)
42     @recipients = message.recipient.email
43     @from = 'abuse@openstreetmap.org'
44     @subject = "[OpenStreetMap] #{message.sender.display_name} sent you a new message"
45     @body['to_user'] = message.recipient.display_name
46     @body['from_user'] = message.sender.display_name
47     @body['body'] = message.body
48     @body['subject'] = message.title
49     @body['readurl'] = "http://#{SERVER_URL}/message/read/#{message.id}"
50     @body['replyurl'] = "http://#{SERVER_URL}/message/new/#{message.from_user_id}"
51   end
52
53   def friend_notification(friend)
54     @friend = User.find_by_id(friend.user_id)
55     @new_friend = User.find_by_id(friend.friend_user_id)
56     @recipients = @new_friend.email
57     @from = 'abuse@openstreetmap.org'
58     @subject = "[OpenStreetMap] #{@friend.display_name} added you as a friend"
59     @body['user'] = @friend.display_name
60     @body['userurl'] = "http://#{SERVER_URL}/user/#{@friend.display_name}"
61   end
62 end