Commit d07cddb5 authored by jplang's avatar jplang

"I don't want to be notified of changes that I make myself" as Default for all User (#14574).

git-svn-id: https://svn.redmine.org/redmine/trunk@15288 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 9357dbe3
......@@ -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
......
......@@ -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
......@@ -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,
......
......@@ -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,
......
......@@ -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
......
......@@ -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,
......
......@@ -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,
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment