Refactor: move method to model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4224 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-09-28 22:13:11 +00:00
parent 437690119b
commit 747b9ec568
3 changed files with 13 additions and 23 deletions
+1 -16
View File
@@ -77,14 +77,6 @@ class UsersController < ApplicationController
@user = User.new(:language => Setting.default_language)
@auth_sources = AuthSource.find(:all)
# TODO: Similar to My#account
# Only users that belong to more than 1 project can select projects for which they are notified
# Note that @user.membership.size would fail since AR ignores
# :include association option when doing a count
if @user.memberships.length < 1
@notification_options.delete_if {|option| option.first == :selected}
end
end
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
@@ -121,14 +113,7 @@ class UsersController < ApplicationController
def edit
@user = User.find(params[:id])
# TODO: Similar to My#account
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
# Only users that belong to more than 1 project can select projects for which they are notified
# Note that @user.membership.size would fail since AR ignores
# :include association option when doing a count
if @user.memberships.length < 1
@notification_options.delete_if {|option| option.first == :selected}
end
@notification_options = @user.valid_notification_options
@notification_option = @user.mail_notification
if request.post?