@@ -354,7 +354,7 class User < Principal | |||||
354 |
|
354 | |||
355 | def notified_project_ids=(ids) |
|
355 | def notified_project_ids=(ids) | |
356 | @notified_projects_ids_changed = true |
|
356 | @notified_projects_ids_changed = true | |
357 | @notified_projects_ids = ids |
|
357 | @notified_projects_ids = ids.map(&:to_i).uniq.select {|n| n > 0} | |
358 | end |
|
358 | end | |
359 |
|
359 | |||
360 | # Updates per project notifications (after_save callback) |
|
360 | # Updates per project notifications (after_save callback) |
@@ -913,6 +913,11 class UserTest < ActiveSupport::TestCase | |||||
913 | assert_equal 6, User.valid_notification_options(User.find(2)).size |
|
913 | assert_equal 6, User.valid_notification_options(User.find(2)).size | |
914 | end |
|
914 | end | |
915 |
|
915 | |||
|
916 | def test_notified_project_ids_setter_should_coerce_to_unique_integer_array | |||
|
917 | @jsmith.notified_project_ids = ["1", "123", "2u", "wrong", "12", 6, 12, -35, ""] | |||
|
918 | assert_equal [1, 123, 2, 12, 6], @jsmith.notified_projects_ids | |||
|
919 | end | |||
|
920 | ||||
916 | def test_mail_notification_all |
|
921 | def test_mail_notification_all | |
917 | @jsmith.mail_notification = 'all' |
|
922 | @jsmith.mail_notification = 'all' | |
918 | @jsmith.notified_project_ids = [] |
|
923 | @jsmith.notified_project_ids = [] |
General Comments 0
You need to be logged in to leave comments.
Login now