##// END OF EJS Templates
Added an option on 'My account' for users who don't want to be notified of changes that they make....
Jean-Philippe Lang -
r886:0fe5c7b3e0d8
parent child
Show More
@@ -56,6 +56,7 class MyController < ApplicationController
56 @user.attributes = params[:user]
56 @user.attributes = params[:user]
57 @user.mail_notification = (params[:notification_option] == 'all')
57 @user.mail_notification = (params[:notification_option] == 'all')
58 @user.pref.attributes = params[:pref]
58 @user.pref.attributes = params[:pref]
59 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
59 if @user.save
60 if @user.save
60 @user.pref.save
61 @user.pref.save
61 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
62 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
@@ -121,6 +121,14 class Mailer < ActionMailer::Base
121 default_url_options[:protocol] = Setting.protocol
121 default_url_options[:protocol] = Setting.protocol
122 end
122 end
123
123
124 # Overrides the create_mail method to remove the current user from the recipients and cc
125 # if he doesn't want to receive notifications about what he does
126 def create_mail
127 recipients.delete(User.current.mail) if recipients && User.current.pref[:no_self_notified]
128 cc.delete(User.current.mail) if cc && User.current.pref[:no_self_notified]
129 super
130 end
131
124 # Renders a message with the corresponding layout
132 # Renders a message with the corresponding layout
125 def render_message(method_name, body)
133 def render_message(method_name, body)
126 layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml'
134 layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml'
@@ -32,6 +32,7
32 <% end %></p>
32 <% end %></p>
33 <p><em><%= l(:text_user_mail_option) %></em></p>
33 <p><em><%= l(:text_user_mail_option) %></em></p>
34 <% end %>
34 <% end %>
35 <p><label><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified] %> I don't want to be notified of changes that I make myself.</label></p>
35 </div>
36 </div>
36 </div>
37 </div>
37 <% end %>
38 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now