Skip to content

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

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.rb
index 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 < ApplicationRecord
class << self
def 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 flag
end
def 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 flag
end
end
diff --git a/modules/costs/app/views/admin/costs_settings/show.html.erb b/modules/costs/app/views/admin/costs_settings/show.html.erb
index 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.submit
end
end
end
end
- 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 do
admin_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.rb
index 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: :boolean
end
- 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: false
patches %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.rb
index 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 do
include Redmine::I18n
shared_let(:project) { create(:project_with_types) }
@@ -80,7 +80,11 @@ RSpec.describe "time entry dialog", :js, with_flag: :track_start_and_end_times_f
end
context "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
+ } do
it "shows fields to track start and end times" do
time_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.rb
index 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 do
end
describe ".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 }
end
end
@@ -545,47 +533,23 @@ RSpec.describe TimeEntry do
end
describe ".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 }
end
end
- 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 }
end
end
end
diff --git a/modules/costs/spec/requests/api/time_entries/create_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/create_resource_spec.rb
index 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 } do
include Rack::Test::Methods
include API::V3::Utilities::PathHelper
diff --git a/modules/costs/spec/requests/api/time_entry_resource_spec.rb b/modules/costs/spec/requests/api/time_entry_resource_spec.rb
index 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" do
end
end
- 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 } do
context "when start and end time were tracked" do
let!(:time_entry) do
create(:time_entry, :with_start_and_end_time, project:, work_package:, user: current_user)
@@ -370,9 +368,7 @@ RSpec.describe "API v3 time_entry resource" do
end
end
- 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 } do
context "when start and end time were tracked" do
let!(:time_entry) do
create(: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.rb
index 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 do
shared_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.rb
index 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 do
shared_let(:project) { create(:project) }
shared_let(:user) { create(:admin) }
shared_let(:work_package) { create(:work_package, project:) }