diff app/controllers/my_controller.rb @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents ef125e1f3a10
children 5e80956cc792
line wrap: on
line diff
--- a/app/controllers/my_controller.rb	Thu Jun 09 16:51:06 2011 +0100
+++ b/app/controllers/my_controller.rb	Thu Jul 14 10:43:07 2011 +0100
@@ -19,6 +19,7 @@
   before_filter :require_login
 
   helper :issues
+  helper :users
   helper :custom_fields
 
   BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
@@ -33,7 +34,7 @@
            }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
 
   DEFAULT_LAYOUT = {  'left' => ['tipoftheday', 'activitymyprojects'], 
-                      'right' => ['issueswatched','calendar'] 
+                      'right' => ['issueswatched'] 
                    }.freeze
 
   verify :xhr => true,
@@ -64,8 +65,7 @@
      end    
     
     if request.post?
-      @user.attributes = params[:user]
-      @user.mail_notification = params[:notification_option] || 'only_my_events'
+      @user.safe_attributes = params[:user]
       @user.pref.attributes = params[:pref]
       @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
 
@@ -90,15 +90,13 @@
                   
       if @user.save
         @user.pref.save
-        @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
+        @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
         set_language_if_valid @user.language
         flash[:notice] = l(:notice_account_updated)
         redirect_to :action => 'account'
         return
       end
     end
-    @notification_options = @user.valid_notification_options
-    @notification_option = @user.mail_notification #? ? 'all' : (@user.notified_projects_ids.empty? ? 'none' : 'selected')    
   end
 
   # Manage user's password