diff options
author | Ezekiel Kigbo <ekigbo@gitlab.com> | 2019-05-08 00:58:16 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-05-08 00:58:16 +0300 |
commit | 3ad6653b3e64ad81278cbbc24dacd15bd2d32e6f (patch) | |
tree | d481264c2003dd5f26da4f61da413d19db96c057 /app/models | |
parent | 9d4450263fd7dc53dafd62389871d8b1fcea5e1a (diff) |
Added user time settings fields to profile
Udpated user_edit_profile_spec with time preferences
Minor update form fields
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 3 | ||||
-rw-r--r-- | app/models/user_preference.rb | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 4a1bf5514fe..60f69659a6b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -230,6 +230,9 @@ class User < ApplicationRecord delegate :notes_filter_for, to: :user_preference delegate :set_notes_filter, to: :user_preference delegate :first_day_of_week, :first_day_of_week=, to: :user_preference + delegate :timezone, :timezone=, to: :user_preference + delegate :time_display_relative, :time_display_relative=, to: :user_preference + delegate :time_format_in_24h, :time_format_in_24h=, to: :user_preference accepts_nested_attributes_for :user_preference, update_only: true diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 282b192167f..f1326f4c8cb 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -10,6 +10,10 @@ class UserPreference < ApplicationRecord validates :issue_notes_filter, :merge_request_notes_filter, inclusion: { in: NOTES_FILTERS.values }, presence: true + default_value_for :timezone, value: Time.zone.tzinfo.name, allows_nil: false + default_value_for :time_display_relative, value: true, allows_nil: false + default_value_for :time_format_in_24h, value: false, allows_nil: false + class << self def notes_filters { |