##// 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 56 @user.attributes = params[:user]
57 57 @user.mail_notification = (params[:notification_option] == 'all')
58 58 @user.pref.attributes = params[:pref]
59 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
59 60 if @user.save
60 61 @user.pref.save
61 62 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
@@ -121,6 +121,14 class Mailer < ActionMailer::Base
121 121 default_url_options[:protocol] = Setting.protocol
122 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 132 # Renders a message with the corresponding layout
125 133 def render_message(method_name, body)
126 134 layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml'
@@ -32,6 +32,7
32 32 <% end %></p>
33 33 <p><em><%= l(:text_user_mail_option) %></em></p>
34 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 36 </div>
36 37 </div>
37 38 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now