Feature #21503 » Email_Self_Notification_Setting.diff
| app/models/user_preference.rb (working copy) | ||
|---|---|---|
|
def initialize(attributes=nil, *args)
|
||
|
super
|
||
|
if new_record? && !(attributes && attributes.key?(:hide_mail))
|
||
|
self.hide_mail = Setting.default_users_hide_mail?
|
||
|
if new_record?
|
||
|
if !(attributes && attributes.key?(:hide_mail))
|
||
|
self.hide_mail = Setting.default_users_hide_mail?
|
||
|
end
|
||
|
if !(attributes && attributes.key?(:no_self_notified))
|
||
|
self.no_self_notified = !Setting.default_users_self_notification?
|
||
|
end
|
||
|
end
|
||
|
self.others ||= {}
|
||
|
end
|
||
| app/views/settings/_authentication.html.erb (working copy) | ||
|---|---|---|
|
<div class="tabular settings">
|
||
|
<p><%= setting_check_box :default_users_hide_mail, :label => :field_hide_mail %></p>
|
||
|
<p><%= setting_check_box :default_users_self_notification, :label => :field_self_notification %></p>
|
||
|
</div>
|
||
|
</fieldset>
|
||
| config/locales/en.yml (working copy) | ||
|---|---|---|
|
field_done_ratio: "% Done"
|
||
|
field_auth_source: Authentication mode
|
||
|
field_hide_mail: Hide my email address
|
||
|
field_self_notification: Email self notification
|
||
|
field_comments: Comment
|
||
|
field_url: URL
|
||
|
field_start_page: Start page
|
||
| config/settings.yml (working copy) | ||
|---|---|---|
|
# multiple values accepted, comma separated
|
||
|
default_users_hide_mail:
|
||
|
default: 1
|
||
|
default_users_self_notification:
|
||
|
default: 1
|
||
|
repositories_encodings:
|
||
|
default: ''
|
||
|
# encoding used to convert commit logs to UTF-8
|
||
| test/unit/user_preference_test.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_self_notification_should_default_to_true
|
||
|
preference = UserPreference.new
|
||
|
assert_equal true, preference.self_notification
|
||
|
end
|
||
|
def test_self_notification_should_default_to_false_with_setting
|
||
|
with_settings :default_users_self_notification => '0' do
|
||
|
preference = UserPreference.new
|
||
|
assert_equal false, preference.self_notification
|
||
|
end
|
||
|
end
|
||
|
def test_create
|
||
|
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
|
||
|
user.login = "newuser"
|
||
- « Previous
- 1
- 2
- Next »