Skip to content

Commit 10c2210

Browse files
authored
[#61070] Remove feature flag for start/end times for time logging (opf#17775)
* [#61070] Remove feature flag for start/end times for time logging https://community.openproject.org/work_packages/61070 * remove track_start_and_end_times_for_time_entries feature decision
1 parent 0034c17 commit 10c2210

File tree

8 files changed

+27
-76
lines changed

8 files changed

+27
-76
lines changed

Diff for: modules/costs/app/models/time_entry.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ def end_timestamp
164164

165165
class << self
166166
def can_track_start_and_end_time?(_project: nil)
167-
OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active? &&
168-
Setting.allow_tracking_start_and_end_times?
167+
Setting.allow_tracking_start_and_end_times?
169168
# TODO: Add project check when we have decided if we also want a project specific flag
170169
end
171170

Diff for: modules/costs/app/views/costs_settings/show.html.erb

+7-9
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ See COPYRIGHT and LICENSE files for more details.
5252
<%= setting_text_field :costs_currency_format, type: :string, container_class: "-middle" %>
5353
</div>
5454

55-
<%- if OpenProject::FeatureDecisions.track_start_and_end_times_for_time_entries_active? %>
56-
<div class="form--field">
57-
<%= setting_check_box :allow_tracking_start_and_end_times, container_class: "-middle" %>
58-
</div>
59-
60-
<div class="form--field">
61-
<%= setting_check_box :enforce_tracking_start_and_end_times, container_class: "-middle" %>
62-
</div>
63-
<%- end %>
55+
<div class="form--field">
56+
<%= setting_check_box :allow_tracking_start_and_end_times, container_class: "-middle" %>
57+
</div>
58+
59+
<div class="form--field">
60+
<%= setting_check_box :enforce_tracking_start_and_end_times, container_class: "-middle" %>
61+
</div>
6462
</section>
6563

6664

Diff for: modules/costs/lib/costs/engine.rb

-5
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@ class Engine < ::Rails::Engine
146146
::Settings::Definition.add "enforce_tracking_start_and_end_times", default: false, format: :boolean
147147
end
148148

149-
initializer "costs.feature_decisions" do
150-
OpenProject::FeatureDecisions.add :track_start_and_end_times_for_time_entries,
151-
description: "Allows admins to enable tracking start and end times for time entries"
152-
end
153-
154149
activity_provider :time_entries, class_name: "Activities::TimeEntryActivityProvider", default: false
155150

156151
patches %i[Project User PermittedParams]

Diff for: modules/costs/spec/features/time_entry_dialog_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper.rb")
3232

33-
RSpec.describe "time entry dialog", :js, with_flag: :track_start_and_end_times_for_time_entries do
33+
RSpec.describe "time entry dialog", :js do
3434
include Redmine::I18n
3535

3636
shared_let(:project) { create(:project_with_types) }

Diff for: modules/costs/spec/models/time_entry_spec.rb

+14-50
Original file line numberDiff line numberDiff line change
@@ -408,24 +408,12 @@ def ensure_membership(project, user, permissions)
408408
end
409409

410410
describe ".can_track_start_and_end_time?" do
411-
context "with the feature flag enabled", with_flag: { track_start_and_end_times_for_time_entries: true } do
412-
context "with the setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do
413-
it { expect(described_class).to be_can_track_start_and_end_time }
414-
end
415-
416-
context "with the setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do
417-
it { expect(described_class).not_to be_can_track_start_and_end_time }
418-
end
411+
context "with the setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do
412+
it { expect(described_class).to be_can_track_start_and_end_time }
419413
end
420414

421-
context "with the feature flag disabled", with_flag: { track_start_and_end_times_for_time_entries: false } do
422-
context "with the setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do
423-
it { expect(described_class).not_to be_can_track_start_and_end_time }
424-
end
425-
426-
context "with the setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do
427-
it { expect(described_class).not_to be_can_track_start_and_end_time }
428-
end
415+
context "with the setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do
416+
it { expect(described_class).not_to be_can_track_start_and_end_time }
429417
end
430418
end
431419

@@ -522,47 +510,23 @@ def ensure_membership(project, user, permissions)
522510
end
523511

524512
describe ".must_track_start_and_end_time?" do
525-
context "with the feature flag enabled", with_flag: { track_start_and_end_times_for_time_entries: true } do
526-
context "with the allow setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do
527-
context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do
528-
it { expect(described_class).to be_must_track_start_and_end_time }
529-
end
530-
531-
context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do
532-
it { expect(described_class).not_to be_must_track_start_and_end_time }
533-
end
513+
context "with the allow setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do
514+
context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do
515+
it { expect(described_class).to be_must_track_start_and_end_time }
534516
end
535517

536-
context "with the allow setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do
537-
context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do
538-
it { expect(described_class).not_to be_must_track_start_and_end_time }
539-
end
540-
541-
context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do
542-
it { expect(described_class).not_to be_must_track_start_and_end_time }
543-
end
518+
context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do
519+
it { expect(described_class).not_to be_must_track_start_and_end_time }
544520
end
545521
end
546522

547-
context "with the feature flag disabled", with_flag: { track_start_and_end_times_for_time_entries: false } do
548-
context "with the allow setting enabled", with_settings: { allow_tracking_start_and_end_times: true } do
549-
context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do
550-
it { expect(described_class).not_to be_must_track_start_and_end_time }
551-
end
552-
553-
context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do
554-
it { expect(described_class).not_to be_must_track_start_and_end_time }
555-
end
523+
context "with the allow setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do
524+
context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do
525+
it { expect(described_class).not_to be_must_track_start_and_end_time }
556526
end
557527

558-
context "with the allow setting disabled", with_settings: { allow_tracking_start_and_end_times: false } do
559-
context "with the enforce setting enabled", with_settings: { enforce_tracking_start_and_end_times: true } do
560-
it { expect(described_class).not_to be_must_track_start_and_end_time }
561-
end
562-
563-
context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do
564-
it { expect(described_class).not_to be_must_track_start_and_end_time }
565-
end
528+
context "with the enforce setting disabled", with_settings: { enforce_tracking_start_and_end_times: false } do
529+
it { expect(described_class).not_to be_must_track_start_and_end_time }
566530
end
567531
end
568532
end

Diff for: modules/costs/spec/requests/api/time_entry_resource_spec.rb

+2-6
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,7 @@
333333
end
334334
end
335335

336-
context "when start- & end-time tracking is enabled",
337-
with_flag: { track_start_and_end_times_for_time_entries: true },
338-
with_settings: { allow_tracking_start_and_end_times: true } do
336+
context "when start- & end-time tracking is enabled", with_settings: { allow_tracking_start_and_end_times: true } do
339337
context "when start and end time were tracked" do
340338
let!(:time_entry) do
341339
create(:time_entry, :with_start_and_end_time, project:, work_package:, user: current_user)
@@ -373,9 +371,7 @@
373371
end
374372
end
375373

376-
context "when start- & end-time tracking is disabled",
377-
with_flag: { track_start_and_end_times_for_time_entries: false },
378-
with_settings: { allow_tracking_start_and_end_times: false } do
374+
context "when start- & end-time tracking is disabled", with_settings: { allow_tracking_start_and_end_times: false } do
379375
context "when start and end time were tracked" do
380376
let!(:time_entry) do
381377
create(:time_entry, :with_start_and_end_time, project:, work_package:, user: current_user)

Diff for: modules/reporting/spec/features/export_cost_report_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
require_relative "../spec_helper"
3232
require_relative "support/pages/cost_report_page"
3333

34-
RSpec.describe "Cost reports XLS export", :js, with_flag: { track_start_and_end_times_for_time_entries: true } do
34+
RSpec.describe "Cost reports XLS export", :js do
3535
shared_let(:project) { create(:project) }
3636
shared_let(:user) { create(:admin) }
3737
shared_let(:cost_type) { create(:cost_type, name: "Post-war", unit: "cap", unit_plural: "caps") }

Diff for: modules/reporting/spec/features/time_entries_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
require_relative "support/pages/cost_report_page"
55
require_relative "support/components/cost_reports_base_table"
66

7-
RSpec.describe "Cost report showing time entries with start & end times", :js,
8-
with_flag: { track_start_and_end_times_for_time_entries: true } do
7+
RSpec.describe "Cost report showing time entries with start & end times", :js do
98
shared_let(:project) { create(:project) }
109
shared_let(:user) { create(:admin) }
1110
shared_let(:work_package) { create(:work_package, project:) }

0 commit comments

Comments
 (0)