Project

General

Profile

Feature #34787 » 34787.patch

Go MAEDA, 2021-02-23 15:03

View differences:

app/models/user_preference.rb
52 52
        self.time_zone = Setting.default_users_time_zone
53 53
      end
54 54
      unless attributes && attributes.key?(:no_self_notified)
55
        self.no_self_notified = true
55
        self.no_self_notified = Setting.default_users_no_self_notified
56 56
      end
57 57
    end
58 58
    self.others ||= {}
app/views/settings/_users.html.erb
19 19

  
20 20
    <p><%= setting_select(:default_notification_option, User.valid_notification_options.collect {|o| [l(o.last), o.first.to_s]}) %></p>
21 21

  
22
    <p><%= setting_check_box :default_users_no_self_notified, :label => :label_user_mail_no_self_notified %></p>
23

  
22 24
    <p><%= setting_select :default_users_time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :label => :field_time_zone, :blank => :label_none %></p>
23 25
  </fieldset>
24 26

  
config/settings.yml
279 279
# multiple values accepted, comma separated
280 280
default_users_hide_mail:
281 281
  default: 1
282
default_users_no_self_notified:
283
  default: 1
282 284
default_users_time_zone:
283 285
  default: ""
284 286
repositories_encodings:
test/unit/user_preference_test.rb
50 50
    assert_equal true, preference.no_self_notified
51 51
  end
52 52

  
53
  def test_no_self_notified_should_default_to_setting
54
    with_settings :default_users_no_self_notified => '0' do
55
      preference = UserPreference.new
56
      assert_equal false, preference.no_self_notified
57
    end
58
  end
59

  
53 60
  def test_create
54 61
    user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
55 62
    user.login = "newuser"
(2-2/2)