OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
remove method that used to convert to tzinfo
ulferts92cc5a603e11
diff --git a/app/cells/settings/time_zone_setting_cell.rb b/app/cells/settings/time_zone_setting_cell.rbindex 344e9f99db7..3b9696f46a0 100644--- a/app/cells/settings/time_zone_setting_cell.rb+++ b/app/cells/settings/time_zone_setting_cell.rb@@ -63,7 +63,7 @@ module Settingsend# If there are multiple AS::TimeZones for a single TZInfo::Timezone, we- # one return the one that is the namesake.+ # only return the one that is the namesake.def namesake_time_zone(time_zones)if time_zones.length == 1time_zones.firstdiff --git a/app/models/user_preference.rb b/app/models/user_preference.rbindex 1eeab687538..c46442a6f30 100644--- a/app/models/user_preference.rb+++ b/app/models/user_preference.rb@@ -130,13 +130,6 @@ class UserPreference < ApplicationRecordsuper.presence || [1, 2, 3, 4, 5]end- def canonical_time_zone- return if time_zone.nil?-- zone = ActiveSupport::TimeZone.new(time_zone)- zone&.tzinfo&.canonical_identifier- end-privatedef to_boolean(value)diff --git a/lib/api/v3/user_preferences/user_preference_representer.rb b/lib/api/v3/user_preferences/user_preference_representer.rbindex c49585903dd..c34ed881258 100644--- a/lib/api/v3/user_preferences/user_preference_representer.rb+++ b/lib/api/v3/user_preferences/user_preference_representer.rb@@ -57,7 +57,6 @@ module APIproperty :hide_mailproperty :time_zone,- getter: ->(*) { canonical_time_zone },render_nil: trueproperty :warn_on_leaving_unsaveddiff --git a/spec/lib/api/v3/user_preferences/user_preference_representer_rendering_spec.rb b/spec/lib/api/v3/user_preferences/user_preference_representer_rendering_spec.rbindex d380f80df81..d105fc31e8d 100644--- a/spec/lib/api/v3/user_preferences/user_preference_representer_rendering_spec.rb+++ b/spec/lib/api/v3/user_preferences/user_preference_representer_rendering_spec.rb@@ -59,7 +59,7 @@ describe ::API::V3::UserPreferences::UserPreferenceRepresenter,it { expect(subject).to have_json_path('autoHidePopups') }describe 'timeZone' do- context 'no time zone set' do+ context 'without a timezone set' dolet(:preference) { FactoryBot.build(:user_preference, time_zone: '') }it 'shows the timeZone as nil' do@@ -67,15 +67,7 @@ describe ::API::V3::UserPreferences::UserPreferenceRepresenter,endend- context 'short timezone set' do- let(:preference) { FactoryBot.build(:user_preference, time_zone: 'Berlin') }-- it 'shows the canonical time zone' do- expect(subject).to be_json_eql('Europe/Berlin'.to_json).at_path('timeZone')- end- end-- context 'canonical timezone set' do+ context 'with a timezone set' dolet(:preference) { FactoryBot.build(:user_preference, time_zone: 'Europe/Paris') }it 'shows the canonical time zone' dodiff --git a/spec/models/user_preference_spec.rb b/spec/models/user_preference_spec.rbindex f6ad4f4220d..68534f8fbff 100644--- a/spec/models/user_preference_spec.rb+++ b/spec/models/user_preference_spec.rb@@ -165,20 +165,6 @@ describe UserPreference doendend- describe 'time_zone' do- it 'allows to save short time zones' do- subject.time_zone = 'Berlin'- expect(subject.time_zone).to eq('Berlin')- expect(subject.canonical_time_zone).to eq('Europe/Berlin')- end-- it 'allows to set full time zones' do- subject.time_zone = 'Europe/Paris'- expect(subject.time_zone).to eq('Europe/Paris')- expect(subject.canonical_time_zone).to eq('Europe/Paris')- end- end-describe '[]=' dolet(:user) { FactoryBot.create(:user) }diff --git a/spec/requests/api/v3/user_preferences/user_preferences_resource_spec.rb b/spec/requests/api/v3/user_preferences/user_preferences_resource_spec.rbindex e7f766251cc..ca794ad65e5 100644--- a/spec/requests/api/v3/user_preferences/user_preferences_resource_spec.rb+++ b/spec/requests/api/v3/user_preferences/user_preferences_resource_spec.rb@@ -162,7 +162,7 @@ describe 'API v3 UserPreferences resource', type: :request, content_type: :jsonendend- context 'with full time zone' do+ context 'with valid time zone' dolet(:params) do{ timeZone: 'Europe/Paris' }end@@ -172,18 +172,6 @@ describe 'API v3 UserPreferences resource', type: :request, content_type: :jsonexpect(preference.time_zone).to eq('Europe/Paris')endend-- context 'with short time zone' do- let(:params) do- { timeZone: 'Hawaii' }- end-- it 'responds with a UserPreferences representer' do- expect(subject.body).to be_json_eql('Pacific/Honolulu'.to_json).at_path('timeZone')- expect(preference.time_zone).to eq('Hawaii')- expect(preference.canonical_time_zone).to eq('Pacific/Honolulu')- end- endendendend