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
[#61070] Remove feature flag for start/end times for time logging (#17775)
Klaus Zanders10c2210ddbcf
diff --git a/modules/costs/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rbindex 02c4b77922c..2e3cf9b7788 100644--- a/modules/costs/app/models/time_entry.rb+++ b/modules/costs/app/models/time_entry.rb@@ -164,8 +164,7 @@ 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 flagenddiff --git a/modules/costs/app/views/costs_settings/show.html.erb b/modules/costs/app/views/costs_settings/show.html.erbindex 1f4be12f663..51d915e9962 100644--- a/modules/costs/app/views/costs_settings/show.html.erb+++ b/modules/costs/app/views/costs_settings/show.html.erb@@ -52,15 +52,13 @@ See COPYRIGHT and LICENSE files for more details.<%= setting_text_field :costs_currency_format, type: :string, container_class: "-middle" %></div>- <%- if OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active? %>- <div class="form--field">- <%= setting_check_box :allow_tracking_start_and_end_times, container_class: "-middle" %>- </div>-- <div class="form--field">- <%= setting_check_box :enforce_tracking_start_and_end_times, container_class: "-middle" %>- </div>- <%- end %>+ <div class="form--field">+ <%= setting_check_box :allow_tracking_start_and_end_times, container_class: "-middle" %>+ </div>++ <div class="form--field">+ <%= setting_check_box :enforce_tracking_start_and_end_times, container_class: "-middle" %>+ </div></section>diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex 553062b1338..ab08faaabaf 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -146,11 +146,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 ac2f56cb27a..7718d45a06d 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 File.expand_path("#{File.dirname(__FILE__)}/../spec_helper.rb")-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) }diff --git a/modules/costs/spec/models/time_entry_spec.rb b/modules/costs/spec/models/time_entry_spec.rbindex 26efdb2e59d..db0c95a17b7 100644--- a/modules/costs/spec/models/time_entry_spec.rb+++ b/modules/costs/spec/models/time_entry_spec.rb@@ -408,24 +408,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@@ -522,47 +510,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_entry_resource_spec.rb b/modules/costs/spec/requests/api/time_entry_resource_spec.rbindex 1cb7b195a26..ea5e1d80ffd 100644--- a/modules/costs/spec/requests/api/time_entry_resource_spec.rb+++ b/modules/costs/spec/requests/api/time_entry_resource_spec.rb@@ -333,9 +333,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)@@ -373,9 +371,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:) }