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
persist time zone for user
Klaus Zanders4fd6e9d08339
diff --git a/modules/costs/app/services/time_entries/set_attributes_service.rb b/modules/costs/app/services/time_entries/set_attributes_service.rbindex 0a9f860ef1b..08a513ba65e 100644--- a/modules/costs/app/services/time_entries/set_attributes_service.rb+++ b/modules/costs/app/services/time_entries/set_attributes_service.rb@@ -41,6 +41,11 @@ module TimeEntriesset_default_attributes(params) if model.new_record?+ # move the timezone from the user+ model.change_by_system do+ model.time_zone = model.user.time_zone.name+ end+# Always set the logging user as logged_byset_logged_byenddiff --git a/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb b/modules/costs/spec/services/time_entries/set_attributes_service_spec.rbindex c80114b25eb..dd7bf0b2f24 100644--- a/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb+++ b/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb@@ -148,6 +148,15 @@ RSpec.describe TimeEntries::SetAttributesService, type: :model doendend+ context "with a user with a defined timezone" do+ it "extracts the current timezone from the user and stores it in the time entry" do+ user.pref[:time_zone] = "America/Los_Angeles"+ subject++ expect(time_entry_instance.time_zone).to eq "America/Los_Angeles"+ end+ end+context "with hours == 0" dolet(:params) do{