summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-03 11:33:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-03 11:33:28 +0000
commit05a9275fdaabf5fd38f060fb9bd96456d4db3dd6 (patch)
treeea89e81e13d67223b639d1319748f40760f4d859
parent25eb92c0dc337b3a1167642433a3d6af73c1a68d (diff)
downloadredmine-05a9275fdaabf5fd38f060fb9bd96456d4db3dd6.tar.gz
redmine-05a9275fdaabf5fd38f060fb9bd96456d4db3dd6.zip
"I don't want to be notified of changes that I make myself" as Default for all User (#14574).
git-svn-id: http://svn.redmine.org/redmine/trunk@15288 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/user_preference.rb3
-rw-r--r--test/fixtures/user_preferences.yml12
-rw-r--r--test/functional/issues_controller_test.rb2
-rw-r--r--test/functional/issues_custom_fields_visibility_test.rb2
-rw-r--r--test/functional/messages_controller_test.rb2
-rw-r--r--test/unit/issue_test.rb2
-rw-r--r--test/unit/mail_handler_test.rb2
-rw-r--r--test/unit/user_preference_test.rb10
8 files changed, 24 insertions, 11 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 461b63840..0fdbfb508 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -28,6 +28,9 @@ class UserPreference < ActiveRecord::Base
if new_record? && !(attributes && attributes.key?(:hide_mail))
self.hide_mail = Setting.default_users_hide_mail?
end
+ if new_record? && !(attributes && attributes.key?(:no_self_notified))
+ self.no_self_notified = true
+ end
self.others ||= {}
end
diff --git a/test/fixtures/user_preferences.yml b/test/fixtures/user_preferences.yml
index 04abb4343..14243e0bb 100644
--- a/test/fixtures/user_preferences.yml
+++ b/test/fixtures/user_preferences.yml
@@ -2,6 +2,7 @@
user_preferences_001:
others: |
---
+ :no_self_notified: false
:my_page_layout:
left:
- latestnews
@@ -17,6 +18,15 @@ user_preferences_001:
user_preferences_002:
others: |
---
+ :no_self_notified: false
+
+ id: 2
+ user_id: 2
+ hide_mail: true
+user_preferences_003:
+ others: |
+ ---
+ :no_self_notified: false
:my_page_layout:
left:
- latestnews
@@ -26,6 +36,6 @@ user_preferences_002:
top:
- calendar
- id: 2
+ id: 3
user_id: 3
hide_mail: false
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 2dd0f4618..5cb9f8730 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -19,7 +19,7 @@ require File.expand_path('../../test_helper', __FILE__)
class IssuesControllerTest < ActionController::TestCase
fixtures :projects,
- :users, :email_addresses,
+ :users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
diff --git a/test/functional/issues_custom_fields_visibility_test.rb b/test/functional/issues_custom_fields_visibility_test.rb
index dc169b7c1..51b057f4c 100644
--- a/test/functional/issues_custom_fields_visibility_test.rb
+++ b/test/functional/issues_custom_fields_visibility_test.rb
@@ -20,7 +20,7 @@ require File.expand_path('../../test_helper', __FILE__)
class IssuesCustomFieldsVisibilityTest < ActionController::TestCase
tests IssuesController
fixtures :projects,
- :users, :email_addresses,
+ :users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 87bba5fcf..36b0f1dd5 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -18,7 +18,7 @@
require File.expand_path('../../test_helper', __FILE__)
class MessagesControllerTest < ActionController::TestCase
- fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
+ fixtures :projects, :users, :email_addresses, :user_preferences, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
def setup
User.current = nil
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 3daca7184..a07b18ff5 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -18,7 +18,7 @@
require File.expand_path('../../test_helper', __FILE__)
class IssueTest < ActiveSupport::TestCase
- fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles,
+ fixtures :projects, :users, :email_addresses, :user_preferences, :members, :member_roles, :roles,
:groups_users,
:trackers, :projects_trackers,
:enabled_modules,
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 1cba22f80..f08f2a6cd 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -22,7 +22,7 @@ require File.expand_path('../../test_helper', __FILE__)
class MailHandlerTest < ActiveSupport::TestCase
fixtures :users, :projects, :enabled_modules, :roles,
:members, :member_roles, :users,
- :email_addresses,
+ :email_addresses, :user_preferences,
:issues, :issue_statuses,
:workflows, :trackers, :projects_trackers,
:versions, :enumerations, :issue_categories,
diff --git a/test/unit/user_preference_test.rb b/test/unit/user_preference_test.rb
index a2f3c7f1f..7303d178f 100644
--- a/test/unit/user_preference_test.rb
+++ b/test/unit/user_preference_test.rb
@@ -32,6 +32,11 @@ class UserPreferenceTest < ActiveSupport::TestCase
end
end
+ def test_no_self_notified_should_default_to_true
+ preference = UserPreference.new
+ assert_equal true, preference.no_self_notified
+ end
+
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
user.login = "newuser"
@@ -67,11 +72,6 @@ class UserPreferenceTest < ActiveSupport::TestCase
assert_kind_of Hash, up.others
end
- def test_others_should_be_blank_after_initialization
- pref = User.new.pref
- assert_equal({}, pref.others)
- end
-
def test_reading_value_from_nil_others_hash
up = UserPreference.new(:user => User.new)
up.others = nil