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
fix showing a message in case no own time zone is configured
ulferts48377fc73e59
diff --git a/app/models/user.rb b/app/models/user.rbindex 7d6bc21a5f7..96f11b04dd3 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -688,6 +688,6 @@ class User < Principalenddef self.default_admin_account_changed?- !User.active.find_by_login("admin").try(:current_password).try(:matches_plaintext?, "admin") # rubocop:disable Rails/DynamicFindBy+ !User.active.find_by_login("admin").try(:current_password).try(:matches_plaintext?, "admin")endenddiff --git a/app/models/user_preference.rb b/app/models/user_preference.rbindex 769ff84773f..220768c6a2d 100644--- a/app/models/user_preference.rb+++ b/app/models/user_preference.rb@@ -135,6 +135,10 @@ class UserPreference < ApplicationRecordsuper.presence || Setting.user_default_timezone.presence || "Etc/UTC"end+ def time_zone?+ settings["time_zone"].present?+ end+def daily_reminderssuper.presence || { enabled: true, times: ["08:00:00+00:00"] }.with_indifferent_accessenddiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 762142ceeb9..8b4885b68e8 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -96,8 +96,8 @@ class MeetingsController < ApplicationControllerif call.success?text = I18n.t(:notice_successful_create)- if User.current.time_zone.nil?- link = I18n.t(:notice_timezone_missing, zone: Time.zone)+ unless User.current.pref.time_zone?+ link = I18n.t(:notice_timezone_missing, zone: formatted_time_zone_offset)text += " #{view_context.link_to(link, { controller: '/my', action: :settings, anchor: 'pref_time_zone' },class: 'link_to_profile')}"enddiff --git a/spec/models/user_preference_spec.rb b/spec/models/user_preference_spec.rbindex ee7c3286a1b..b482481ae07 100644--- a/spec/models/user_preference_spec.rb+++ b/spec/models/user_preference_spec.rb@@ -244,4 +244,26 @@ RSpec.describe UserPreference doendendend++ describe "#time_zone?" do+ context "with a time zone set and a default configured", with_settings: { user_default_timezone: "America/Los_Angeles" } do+ let(:settings) { { "time_zone" => "Africa/Algiers" } }++ it "is true" do+ expect(preference).to be_time_zone+ end+ end++ context "with no time zone configured but a default", with_settings: { user_default_timezone: "America/Los_Angeles" } do+ it "is false" do+ expect(preference).not_to be_time_zone+ end+ end++ context "with neiter a time zone configured nor a default one", with_settings: { user_default_timezone: "" } do+ it "is false" do+ expect(preference).not_to be_time_zone+ end+ end+ endend