]> source.dussan.org Git - redmine.git/commitdiff
Hide email by default for new users (#21042).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 21 Oct 2015 19:11:39 +0000 (19:11 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 21 Oct 2015 19:11:39 +0000 (19:11 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14726 e93f8b46-1217-0410-a6f0-8f06a7374b81

db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb [new file with mode: 0644]
test/unit/user_preference_test.rb

diff --git a/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb b/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb
new file mode 100644 (file)
index 0000000..fc5d268
--- /dev/null
@@ -0,0 +1,9 @@
+class ChangeUserPreferencesHideMailDefaultToTrue < ActiveRecord::Migration
+  def self.up
+    change_column :user_preferences, :hide_mail, :boolean, :default => true
+  end
+
+  def self.down
+    change_column :user_preferences, :hide_mail, :boolean, :default => false
+  end
+end
index ee5cb65d4805c3f3aa85c2cfdbbca50a7792ce87..c76862408b78e06c806afc1af60b785f0771dba3 100644 (file)
@@ -20,6 +20,11 @@ require File.expand_path('../../test_helper', __FILE__)
 class UserPreferenceTest < ActiveSupport::TestCase
   fixtures :users, :user_preferences
 
+  def test_hide_mail_should_default_to_true
+    preference = UserPreference.new
+    assert_equal true, preference.hide_mail
+  end
+
   def test_create
     user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
     user.login = "newuser"