Commit 4e50d379 authored by Donald Cook's avatar Donald Cook Committed by Olena Horal-Koretska

Removed work_items_hierarchy feature flag

This adds the hierarchy page to all projects.
Also added a new work_items feature flag check for new item types.

Changelog: added
parent 1163e773
......@@ -25,14 +25,20 @@ export default {
workItemTypes() {
return this.workItemHierarchy.reduce(
(itemTypes, item) => {
const skipItem = workItemTypes[item.type].isWorkItem && !window.gon?.features?.workItems;
if (skipItem) {
return itemTypes;
}
const key = item.available ? 'available' : 'unavailable';
const nestedTypes = item.nestedTypes?.map((type) => workItemTypes[type]);
itemTypes[key].push({
...item,
...workItemTypes[item.type],
nestedTypes: item.nestedTypes
? item.nestedTypes.map((type) => workItemTypes[type])
: null,
nestedTypes,
});
return itemTypes;
},
{ available: [], unavailable: [] },
......
......@@ -31,6 +31,7 @@ export const workItemTypes = {
icon: 'task-done',
color: '#217645',
backgroundColor: '#C3E6CD',
isWorkItem: true,
},
INCIDENT: {
title: __('Incident'),
......
......@@ -7,8 +7,6 @@ module PlanningHierarchy
def planning_hierarchy
return access_denied! unless can?(current_user, :read_planning_hierarchy, @project)
return render_404 unless Feature.enabled?(:work_items_hierarchy, @project, default_enabled: :yaml)
render 'shared/planning_hierarchy'
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
......
......@@ -42,6 +42,7 @@ class ProjectsController < Projects::ApplicationController
push_frontend_feature_flag(:new_dir_modal, @project, default_enabled: :yaml)
push_licensed_feature(:file_locks) if @project.present? && @project.licensed_feature_available?(:file_locks)
push_frontend_feature_flag(:consolidated_edit_button, @project, default_enabled: :yaml)
push_frontend_feature_flag(:work_items, @project, default_enabled: :yaml)
end
layout :determine_layout
......
---
name: work_items_hierarchy
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79315
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350451
milestone: '14.8'
type: development
group: group::product planning
default_enabled: false
......@@ -19,8 +19,7 @@ module Sidebars
end
def show_hierarachy_menu_item?(container)
Feature.enabled?(:work_items_hierarchy, container, default_enabled: :yaml) &&
can?(context.current_user, :read_planning_hierarchy, container)
can?(context.current_user, :read_planning_hierarchy, container)
end
end
end
......
......@@ -5,22 +5,7 @@ require 'spec_helper'
RSpec.describe Sidebars::Concerns::WorkItemHierarchy do
shared_examples 'hierarchy menu' do
let(:item_id) { :hierarchy }
context 'when the feature is disabled does not render' do
before do
stub_feature_flags(work_items_hierarchy: false)
end
specify { is_expected.to be_nil }
end
context 'when the feature is enabled does render' do
before do
stub_feature_flags(work_items_hierarchy: true)
end
specify { is_expected.not_to be_nil }
end
specify { is_expected.not_to be_nil }
end
describe 'Project hierarchy menu item' do
......
......@@ -63,21 +63,7 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
describe 'Hierarchy' do
let(:item_id) { :hierarchy }
context 'when the feature is disabled' do
before do
stub_feature_flags(work_items_hierarchy: false)
end
specify { is_expected.to be_nil }
end
context 'when the feature is enabled' do
before do
stub_feature_flags(work_items_hierarchy: true)
end
specify { is_expected.not_to be_nil }
end
specify { is_expected.not_to be_nil }
end
end
end
......@@ -14,21 +14,10 @@ RSpec.describe PlanningHierarchy, type: :request do
describe 'GET #planning_hierarchy' do
it 'renders planning hierarchy' do
stub_feature_flags(work_items_hierarchy: true)
get project_planning_hierarchy_path(project)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to match(/id="js-work-items-hierarchy"/)
end
it 'renders 404 page' do
stub_feature_flags(work_items_hierarchy: false)
get project_planning_hierarchy_path(project)
expect(response).to have_gitlab_http_status(:not_found)
expect(response.body).not_to match(/id="js-work-items-hierarchy"/)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment