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 `track_start_and_end_times_for_time_entries` feature flag
Klaus Zanders9032c2c4255f
diff --git a/modules/costs/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rbindex a665bd6c1f4..886dfe91e7f 100644--- a/modules/costs/app/models/time_entry.rb+++ b/modules/costs/app/models/time_entry.rb@@ -169,13 +169,12 @@ class TimeEntry < ApplicationRecordclass << selfdef can_track_start_and_end_time?(_project: nil)- OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active? &&- Setting.allow_tracking_start_and_end_times?+ Setting.allow_tracking_start_and_end_times?# TODO: Add project check when we have decided if we also want a project specific flagenddef must_track_start_and_end_time?(_project: nil)- can_track_start_and_end_time? && Setting.enforce_tracking_start_and_end_times?+ Setting.enforce_tracking_start_and_end_times?# TODO: Add project check when we have decided if we also want a project specific flagendenddiff --git a/modules/costs/app/views/admin/costs_settings/show.html.erb b/modules/costs/app/views/admin/costs_settings/show.html.erbindex 6c133299d25..8d4092c7a1f 100644--- a/modules/costs/app/views/admin/costs_settings/show.html.erb+++ b/modules/costs/app/views/admin/costs_settings/show.html.erb@@ -44,30 +44,28 @@ See COPYRIGHT and LICENSE files for more details.<%=render(Primer::Alpha::TabPanels.new(label: I18n.t(:project_module_costs))) do |component|- if OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active?- component.with_tab(selected: true, id: "tab-time") do |tab|- tab.with_text { I18n.t(:label_time) }- tab.with_panel do- admin_settings_primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|- render_inline_settings_form(time_form) do |form|- form.html_content do- render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|- subhead.with_heading(size: :medium) { I18n.t(:label_mandatory_fields) }- subhead.with_description { I18n.t(:description_time_settings) }- end+ component.with_tab(selected: true, id: "tab-time") do |tab|+ tab.with_text { I18n.t(:label_time) }+ tab.with_panel do+ admin_settings_primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|+ render_inline_settings_form(time_form) do |form|+ form.html_content do+ render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|+ subhead.with_heading(size: :medium) { I18n.t(:label_mandatory_fields) }+ subhead.with_description { I18n.t(:description_time_settings) }end+ end- form.check_box(name: :allow_tracking_start_and_end_times)- form.check_box(name: :enforce_tracking_start_and_end_times)+ form.check_box(name: :allow_tracking_start_and_end_times)+ form.check_box(name: :enforce_tracking_start_and_end_times)- form.submit- end+ form.submitendendendend- component.with_tab(id: "tab-costs", selected: !OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active?) do |tab|+ component.with_tab(id: "tab-costs") do |tab|tab.with_text { I18n.t(:label_costs) }tab.with_panel doadmin_settings_primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex e0268b78608..32538e828fe 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -153,11 +153,6 @@ module Costs::Settings::Definition.add "enforce_tracking_start_and_end_times", default: false, format: :booleanend- initializer "costs.feature_decisions" do- OpenProject::FeatureDecisions.add :track_start_and_end_times_for_time_entries,- description: "Allows admins to enable tracking start and end times for time entries"- end-activity_provider :time_entries, class_name: "Activities::TimeEntryActivityProvider", default: falsepatches %i[Project User PermittedParams]diff --git a/modules/costs/spec/features/time_entry_dialog_spec.rb b/modules/costs/spec/features/time_entry_dialog_spec.rbindex a295e01bb6c..467563f38cc 100644--- a/modules/costs/spec/features/time_entry_dialog_spec.rb+++ b/modules/costs/spec/features/time_entry_dialog_spec.rb@@ -30,7 +30,7 @@require_relative "../spec_helper"-RSpec.describe "time entry dialog", :js, with_flag: :track_start_and_end_times_for_time_entries do+RSpec.describe "time entry dialog", :js doinclude Redmine::I18nshared_let(:project) { create(:project_with_types) }@@ -80,7 +80,11 @@ RSpec.describe "time entry dialog", :js, with_flag: :track_start_and_end_times_fendcontext "when start and end time is enforced",- with_settings: { allow_tracking_start_and_end_times: true, enforce_tracking_start_and_end_times: true } do+ with_ee: %i[time_entry_time_restrictions],+ with_settings: {+ allow_tracking_start_and_end_times: true,+ enforce_tracking_start_and_end_times: true+ } doit "shows fields to track start and end times" dotime_logging_modal.shows_field("start_time", true)time_logging_modal.requires_field("start_time")diff --git a/modules/costs/spec/models/time_entry_spec.rb b/modules/costs/spec/models/time_entry_spec.rbindex 8ef9fad7413..904d8c6b184 100644--- a/modules/costs/spec/models/time_entry_spec.rb+++ b/modules/costs/spec/models/time_entry_spec.rb@@ -414,24 +414,12 @@ RSpec.describe TimeEntry doenddescribe ".can_track_start_and_end_time?" do- context "with the feature flag enabled", with_flag: { track_start_and_end_times_for_time_entries: true } do- context "with the setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do- it { expect(described_class).to be_can_track_start_and_end_time }- end-- context "with the setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do- it { expect(described_class).not_to be_can_track_start_and_end_time }- end+ context "with the setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do+ it { expect(described_class).to be_can_track_start_and_end_time }end- context "with the feature flag disabled", with_flag: { track_start_and_end_times_for_time_entries: false } do- context "with the setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do- it { expect(described_class).not_to be_can_track_start_and_end_time }- end-- context "with the setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do- it { expect(described_class).not_to be_can_track_start_and_end_time }- end+ context "with the setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do+ it { expect(described_class).not_to be_can_track_start_and_end_time }endend@@ -545,47 +533,23 @@ RSpec.describe TimeEntry doenddescribe ".must_track_start_and_end_time?" do- context "with the feature flag enabled", with_flag: { track_start_and_end_times_for_time_entries: true } do- context "with the allow setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do- context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do- it { expect(described_class).to be_must_track_start_and_end_time }- end-- context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end+ context "with the allow setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do+ context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do+ it { expect(described_class).to be_must_track_start_and_end_time }end- context "with the allow setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do- context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end-- context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end+ context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do+ it { expect(described_class).not_to be_must_track_start_and_end_time }endend- context "with the feature flag disabled", with_flag: { track_start_and_end_times_for_time_entries: false } do- context "with the allow setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do- context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end-- context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end+ context "with the allow setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do+ context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do+ it { expect(described_class).not_to be_must_track_start_and_end_time }end- context "with the allow setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do- context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end-- context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do- it { expect(described_class).not_to be_must_track_start_and_end_time }- end+ context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do+ it { expect(described_class).not_to be_must_track_start_and_end_time }endendenddiff --git a/modules/costs/spec/requests/api/time_entries/create_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/create_resource_spec.rbindex 2c0c4c09ba7..8d035ab6bb0 100644--- a/modules/costs/spec/requests/api/time_entries/create_resource_spec.rb+++ b/modules/costs/spec/requests/api/time_entries/create_resource_spec.rb@@ -33,7 +33,6 @@ require "rack/test"RSpec.describe "API v3 Time Entries resource",content_type: :json,- with_flag: :track_start_and_end_times_for_time_entries,with_settings: { allow_tracking_start_and_end_times: true } doinclude Rack::Test::Methodsinclude API::V3::Utilities::PathHelperdiff --git a/modules/costs/spec/requests/api/time_entry_resource_spec.rb b/modules/costs/spec/requests/api/time_entry_resource_spec.rbindex 12700aab0c2..907de868eb5 100644--- a/modules/costs/spec/requests/api/time_entry_resource_spec.rb+++ b/modules/costs/spec/requests/api/time_entry_resource_spec.rb@@ -330,9 +330,7 @@ RSpec.describe "API v3 time_entry resource" doendend- context "when start- & end-time tracking is enabled",- with_flag: { track_start_and_end_times_for_time_entries: true },- with_settings: { allow_tracking_start_and_end_times: true } do+ context "when start- & end-time tracking is enabled", with_settings: { allow_tracking_start_and_end_times: true } docontext "when start and end time were tracked" dolet!(:time_entry) docreate(:time_entry, :with_start_and_end_time, project:, work_package:, user: current_user)@@ -370,9 +368,7 @@ RSpec.describe "API v3 time_entry resource" doendend- context "when start- & end-time tracking is disabled",- with_flag: { track_start_and_end_times_for_time_entries: false },- with_settings: { allow_tracking_start_and_end_times: false } do+ context "when start- & end-time tracking is disabled", with_settings: { allow_tracking_start_and_end_times: false } docontext "when start and end time were tracked" dolet!(:time_entry) docreate(:time_entry, :with_start_and_end_time, project:, work_package:, user: current_user)diff --git a/modules/reporting/spec/features/export_cost_report_spec.rb b/modules/reporting/spec/features/export_cost_report_spec.rbindex a687fdd7cc4..09dc85507bf 100644--- a/modules/reporting/spec/features/export_cost_report_spec.rb+++ b/modules/reporting/spec/features/export_cost_report_spec.rb@@ -31,7 +31,7 @@require_relative "../spec_helper"require_relative "support/pages/cost_report_page"-RSpec.describe "Cost reports XLS export", :js, with_flag: { track_start_and_end_times_for_time_entries: true } do+RSpec.describe "Cost reports XLS export", :js doshared_let(:project) { create(:project) }shared_let(:user) { create(:admin) }shared_let(:cost_type) { create(:cost_type, name: "Post-war", unit: "cap", unit_plural: "caps") }diff --git a/modules/reporting/spec/features/time_entries_spec.rb b/modules/reporting/spec/features/time_entries_spec.rbindex d7867e33d44..59cf2e54764 100644--- a/modules/reporting/spec/features/time_entries_spec.rb+++ b/modules/reporting/spec/features/time_entries_spec.rb@@ -4,8 +4,7 @@ require "spec_helper"require_relative "support/pages/cost_report_page"require_relative "support/components/cost_reports_base_table"-RSpec.describe "Cost report showing time entries with start & end times", :js,- with_flag: { track_start_and_end_times_for_time_entries: true } do+RSpec.describe "Cost report showing time entries with start & end times", :js doshared_let(:project) { create(:project) }shared_let(:user) { create(:admin) }shared_let(:work_package) { create(:work_package, project:) }