]> source.dussan.org Git - redmine.git/commitdiff
Fixed: "Notifiy for only project I select" is randomly displayed (#7294).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 16 Jan 2011 14:40:38 +0000 (14:40 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 16 Jan 2011 14:40:38 +0000 (14:40 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4727 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb
test/unit/user_test.rb

index 9bfd8302993ee1dc1840c71ac2bdb95e26c1a754..5b107478d03a5325dce8f756cec7e9395a01e035 100644 (file)
@@ -267,7 +267,7 @@ class User < Principal
     # Note that @user.membership.size would fail since AR ignores
     # :include association option when doing a count
     if memberships.length < 1
-      MAIL_NOTIFICATION_OPTIONS.delete_if {|option| option.first == 'selected'}
+      MAIL_NOTIFICATION_OPTIONS.reject {|option| option.first == 'selected'}
     else
       MAIL_NOTIFICATION_OPTIONS
     end
index 39a4d48f5f998c0189c25d31048d5b283cf4e546..98a577ebbad94c535d9b17b761c3c0583dc14bec 100644 (file)
@@ -1,5 +1,5 @@
-# redMine - project management software
-# Copyright (C) 2006  Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2011  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -507,6 +507,13 @@ class UserTest < ActiveSupport::TestCase
     assert_nil @dlopper.roles_for_project(Project.find(2)).detect {|role| role.member?}
   end
   
+  def test_valid_notification_options
+    # without memberships
+    assert_equal 5, User.find(7).valid_notification_options.size
+    # with memberships
+    assert_equal 6, User.find(2).valid_notification_options.size
+  end
+  
   def test_mail_notification_all
     @jsmith.mail_notification = 'all'
     @jsmith.notified_project_ids = []