Skip to content

Commit 8f370d4

Browse files
committed
[#73798] Remove scrum_projects feature flag
Make Backlogs use the sprint-based behavior unconditionally and remove the old feature-flagged branches from controllers, routes, representers, and supporting helpers. Update the affected Backlogs specs and PDF export expectations to match the permanent sprint model and keep list reordering stable when moving work packages between backlog and sprint scopes. https://community.openproject.org/wp/73798
1 parent 4211507 commit 8f370d4

72 files changed

Lines changed: 468 additions & 2830 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/forms/versions/form.rb

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -110,29 +110,6 @@ class Form < ApplicationForm
110110
end
111111
end
112112

113-
if backlogs_enabled?
114-
setting = version_setting_for_project
115-
116-
f.select_list(
117-
name: "version[version_settings_attributes][][display]",
118-
scope_name_to_model: false,
119-
label: I18n.t(:label_column_in_backlog),
120-
input_width: :small
121-
) do |list|
122-
position_display_options.each do |label, value|
123-
list.option(label:, value:, selected: setting.display == value)
124-
end
125-
end
126-
127-
if setting.persisted?
128-
f.hidden(
129-
name: "version[version_settings_attributes][][id]",
130-
value: setting.id,
131-
scope_name_to_model: false
132-
)
133-
end
134-
end
135-
136113
f.hidden(
137114
name: "project_id",
138115
value: project.id,
@@ -177,35 +154,5 @@ def custom_fields
177154
def wiki_pages_disabled?
178155
contract.assignable_wiki_pages.none?
179156
end
180-
181-
def backlogs_enabled?
182-
resolved_project.backlogs_enabled? && !OpenProject::FeatureDecisions.scrum_projects_active?
183-
end
184-
185-
def resolved_project
186-
@project || version.project
187-
end
188-
189-
def version_setting_for_project
190-
setting = version.version_settings.detect { |vs| vs.project_id == resolved_project.id || vs.project_id.nil? }
191-
setting || version.version_settings.new(display: VersionSetting::DISPLAY_LEFT, project: resolved_project)
192-
end
193-
194-
def position_display_options
195-
[VersionSetting::DISPLAY_NONE,
196-
VersionSetting::DISPLAY_LEFT,
197-
VersionSetting::DISPLAY_RIGHT].map { |s| [humanize_display_option(s), s] }
198-
end
199-
200-
def humanize_display_option(option)
201-
case option
202-
when VersionSetting::DISPLAY_NONE
203-
I18n.t("version_settings_display_option_none")
204-
when VersionSetting::DISPLAY_LEFT
205-
I18n.t("version_settings_display_option_left")
206-
when VersionSetting::DISPLAY_RIGHT
207-
I18n.t("version_settings_display_option_right")
208-
end
209-
end
210157
end
211158
end

app/models/permitted_params.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,18 +359,14 @@ def category
359359
end
360360

361361
def version
362-
# `version_settings_attributes` is from a plugin. Unfortunately as it stands
363-
# now it is less work to do it this way than have the plugin override this
364-
# method. We hopefully will change this in the future.
365362
permitted_params = params.fetch(:version, {}).permit(:name,
366363
:description,
367364
:effective_date,
368365
:due_date,
369366
:start_date,
370367
:wiki_page_title,
371368
:status,
372-
:sharing,
373-
version_settings_attributes: %i(id display project_id))
369+
:sharing)
374370

375371
permitted_params.merge(custom_field_values(:version, required: false))
376372
end

config/initializers/feature_decisions.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@
6161
description: "Enables Jira Migration Tool.",
6262
force_active: false
6363

64-
OpenProject::FeatureDecisions.add :scrum_projects,
65-
description: "Enables an overhauled version of the backlogs module to " \
66-
"support Scrum projects with a new sprint planning experience. ",
67-
force_active: true
68-
6964
OpenProject::FeatureDecisions.add :user_working_times,
7065
description: "Enables tracking of user working hours and non-working days."
7166

modules/backlogs/app/components/projects/settings/backlogs/settings_header_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ See COPYRIGHT and LICENSE files for more details.
4444
t.with_text { t("backlogs.done_status") }
4545
end
4646

47-
if OpenProject::FeatureDecisions.scrum_projects_active? && User.current.allowed_in_project?(:share_sprint, project)
47+
if User.current.allowed_in_project?(:share_sprint, project)
4848
tab_nav.with_tab(
4949
selected: selected_tab?(:sharing),
5050
href: project_settings_backlog_sharing_path(project)

modules/backlogs/app/controllers/inbox_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
class InboxController < RbApplicationController
3232
include OpTurbo::ComponentStream
3333

34-
before_action :not_authorized_on_feature_flag_inactive
3534
before_action :load_work_package
3635

3736
# Deferred ActionMenu items (Primer include-fragment).

modules/backlogs/app/controllers/projects/settings/backlogs_controller.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ def update
4242
end
4343

4444
def rebuild_positions
45-
if OpenProject::FeatureDecisions.scrum_projects_active?
46-
WorkPackages::RebuildPositionsService.new(project: @project).call
47-
else
48-
@project.rebuild_positions
49-
end
45+
WorkPackages::RebuildPositionsService.new(project: @project).call
5046
flash[:notice] = I18n.t("backlogs.positions_rebuilt_successfully")
5147

5248
redirect_to_backlogs_settings

modules/backlogs/app/controllers/rb_application_controller.rb

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class RbApplicationController < ApplicationController
3333
helper :rb_common
3434

3535
before_action :load_sprint_and_project,
36-
:check_if_plugin_is_configured,
3736
:authorize
3837

3938
private
@@ -54,25 +53,8 @@ def load_sprint
5453
@sprint_id = params.delete(:sprint_id)
5554
return unless @sprint_id
5655

57-
@sprint = if OpenProject::FeatureDecisions.scrum_projects_active?
58-
Agile::Sprint.for_project(@project).visible.find(@sprint_id)
59-
else
60-
Sprint.visible.apply_to(@project).find(@sprint_id)
61-
end
56+
@sprint = Agile::Sprint.for_project(@project).visible.find_by(id: @sprint_id) ||
57+
Sprint.visible.apply_to(@project).find(@sprint_id)
6258
end
6359

64-
def check_if_plugin_is_configured
65-
return if OpenProject::FeatureDecisions.scrum_projects_active?
66-
67-
settings = Setting.plugin_openproject_backlogs
68-
if settings["story_types"].blank? || settings["task_type"].blank?
69-
respond_to do |format|
70-
format.html { render template: "shared/not_configured" }
71-
end
72-
end
73-
end
74-
75-
def not_authorized_on_feature_flag_inactive
76-
render_403 unless OpenProject::FeatureDecisions.scrum_projects_active?
77-
end
7860
end

modules/backlogs/app/controllers/rb_burndown_charts_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RbBurndownChartsController < RbApplicationController
3232
helper :burndown_charts
3333

3434
def show
35-
@burndown = if OpenProject::FeatureDecisions.scrum_projects_active?
35+
@burndown = if @sprint.is_a?(Agile::Sprint)
3636
Burndown.new(@sprint, @project)
3737
else
3838
@sprint.burndown(@project)

modules/backlogs/app/controllers/rb_master_backlogs_controller.rb

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,10 @@
3131
class RbMasterBacklogsController < RbApplicationController
3232
include WorkPackages::WithSplitView
3333

34-
# Without the feature flag, there is only the top level menu item, select it
35-
menu_item :backlogs_legacy
36-
37-
# With the feature flag, we have a proper menu, select the correct sub entry
3834
current_menu_item [:backlog] do
3935
:backlog
4036
end
4137

42-
before_action :not_authorized_on_feature_flag_inactive, only: :backlog
4338
before_action :load_backlogs, only: %i[index backlog]
4439

4540
def backlog
@@ -51,12 +46,10 @@ def backlog
5146
end
5247

5348
def index
54-
return redirect_to action: :backlog if OpenProject::FeatureDecisions.scrum_projects_active?
55-
5649
if turbo_frame_request?
57-
render partial: "list", layout: false
50+
render partial: "backlog_list", layout: false
5851
else
59-
render :index
52+
render :backlog
6053
end
6154
end
6255

@@ -65,39 +58,25 @@ def details
6558
render "work_packages/split_view", layout: false
6659
else
6760
load_backlogs
68-
69-
if OpenProject::FeatureDecisions.scrum_projects_active?
70-
render :backlog
71-
else
72-
render :index
73-
end
61+
render :backlog
7462
end
7563
end
7664

7765
def split_view_base_route
78-
if OpenProject::FeatureDecisions.scrum_projects_active?
79-
backlog_backlogs_project_backlogs_path(request.query_parameters)
80-
else
81-
backlogs_project_backlogs_path(request.query_parameters)
82-
end
66+
backlog_backlogs_project_backlogs_path(request.query_parameters)
8367
end
8468

8569
private
8670

8771
def load_backlogs
8872
@owner_backlogs = Backlog.owner_backlogs(@project)
89-
90-
if OpenProject::FeatureDecisions.scrum_projects_active?
91-
@sprints = Agile::Sprint.for_project(@project).not_completed.order_by_date
92-
@stories_by_sprint_id = WorkPackage
93-
.where(sprint: @sprints, project: @project)
94-
.includes(:type, :status)
95-
.order_by_position
96-
.group_by(&:sprint_id)
97-
@active_sprint_ids = @sprints.select(&:active?).map(&:id)
98-
@inbox_work_packages = Backlog.inbox_for(project: @project)
99-
else
100-
@sprint_backlogs = Backlog.sprint_backlogs(@project)
101-
end
73+
@sprints = Agile::Sprint.for_project(@project).not_completed.order_by_date
74+
@stories_by_sprint_id = WorkPackage
75+
.where(sprint: @sprints, project: @project)
76+
.includes(:type, :status)
77+
.order_by_position
78+
.group_by(&:sprint_id)
79+
@active_sprint_ids = @sprints.select(&:active?).map(&:id)
80+
@inbox_work_packages = Backlog.inbox_for(project: @project)
10281
end
10382
end

modules/backlogs/app/controllers/rb_stories_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def replace_sprint_component_via_turbo_stream(sprint:)
216216

217217
def load_story
218218
@allowed_stories =
219-
if OpenProject::FeatureDecisions.scrum_projects_active?
219+
if @sprint.is_a?(Agile::Sprint)
220220
WorkPackage.visible.where(sprint: @sprint, project: @project)
221221
else
222222
Story.visible.where(Story.condition(@project, @sprint))

0 commit comments

Comments
 (0)