Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
7f53b46cf3
commit
db94e04401
|
@ -18,16 +18,6 @@ import initSidebarBundle from '~/sidebar/sidebar_bundle';
|
|||
import initWorkItemLinks from '~/work_items/components/work_item_links';
|
||||
import ZenMode from '~/zen_mode';
|
||||
import initAwardsApp from '~/emoji/awards_app';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE } from '~/work_items/constants';
|
||||
import { issuableInitialDataById, isLegacyIssueType } from './show/utils/issuable_data';
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features?.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
export function initForm() {
|
||||
new IssuableForm($('.issue-form')); // eslint-disable-line no-new
|
||||
|
@ -39,14 +29,6 @@ export function initForm() {
|
|||
initTypePopover();
|
||||
initTypeSelect();
|
||||
mountMilestoneDropdown();
|
||||
|
||||
if (gon.features.workItemsViewPreference || gon.features.workItemViewForIssues) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
}
|
||||
|
||||
export function initShow() {
|
||||
|
@ -54,9 +36,6 @@ export function initShow() {
|
|||
addShortcutsExtension(ShortcutsIssuable);
|
||||
new ZenMode(); // eslint-disable-line no-new
|
||||
|
||||
// data is only available before we initialize the app
|
||||
const issuableData = issuableInitialDataById('js-issuable-app');
|
||||
|
||||
initAwardsApp(document.getElementById('js-vue-awards-block'));
|
||||
initIssuableApp(store);
|
||||
initIssuableSidebar();
|
||||
|
@ -70,15 +49,4 @@ export function initShow() {
|
|||
import(/* webpackChunkName: 'design_management' */ '~/design_management')
|
||||
.then((module) => module.default())
|
||||
.catch(() => {});
|
||||
|
||||
if (
|
||||
!isLegacyIssueType(issuableData) &&
|
||||
(gon.features.workItemsViewPreference || gon.features.workItemViewForIssues)
|
||||
) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
import { addShortcutsExtension } from '~/behaviors/shortcuts';
|
||||
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
|
||||
import initBoards from '~/boards';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE } from '~/work_items/constants';
|
||||
|
||||
addShortcutsExtension(ShortcutsNavigation);
|
||||
initBoards();
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (gon.features.workItemsViewPreference || gon.features.workItemViewForIssues) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
|
|
|
@ -1,20 +1,3 @@
|
|||
import { mountIssuesListApp } from '~/issues/list';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE } from '~/work_items/constants';
|
||||
|
||||
mountIssuesListApp();
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (gon.features.workItemsViewPreference || gon.features.workItemViewForIssues) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
import { WORKSPACE_GROUP } from '~/issues/constants';
|
||||
import { NEW_EPIC_FEEDBACK_PROMPT_EXPIRY, FEATURE_NAME } from '~/work_items/constants';
|
||||
import { initWorkItemsRoot } from '~/work_items';
|
||||
import { initWorkItemsFeedback } from '~/work_items_feedback';
|
||||
import { __ } from '~/locale';
|
||||
|
||||
initWorkItemsRoot({ workspaceType: WORKSPACE_GROUP });
|
||||
initWorkItemsFeedback({
|
||||
feedbackIssue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/463598',
|
||||
feedbackIssueText: __('Provide feedback on the experience'),
|
||||
content: __(
|
||||
'We’ve introduced some improvements to the epic page such as real time updates, additional features, and a refreshed design. Have questions or thoughts on the changes?',
|
||||
),
|
||||
title: __('New epic look'),
|
||||
featureName: FEATURE_NAME,
|
||||
expiry: NEW_EPIC_FEEDBACK_PROMPT_EXPIRY,
|
||||
});
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
import { addShortcutsExtension } from '~/behaviors/shortcuts';
|
||||
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
|
||||
import initBoards from '~/boards';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE } from '~/work_items/constants';
|
||||
|
||||
addShortcutsExtension(ShortcutsNavigation);
|
||||
initBoards();
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (gon.features.workItemsViewPreference || gon.features.workItemViewForIssues) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
|
|
|
@ -2,26 +2,9 @@ import { addShortcutsExtension } from '~/behaviors/shortcuts';
|
|||
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
|
||||
import { mountIssuesListApp, mountJiraIssuesListApp } from '~/issues/list';
|
||||
import { initWorkItemsRoot } from '~/work_items';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE } from '~/work_items/constants';
|
||||
|
||||
mountIssuesListApp();
|
||||
mountJiraIssuesListApp();
|
||||
addShortcutsExtension(ShortcutsNavigation);
|
||||
|
||||
initWorkItemsRoot();
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (gon.features.workItemsViewPreference || gon.features.workItemViewForIssues) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
|
|
|
@ -2,26 +2,9 @@ import { initForm } from 'ee_else_ce/issues';
|
|||
import { mountMarkdownEditor } from 'ee_else_ce/vue_shared/components/markdown/mount_markdown_editor';
|
||||
import IssuableTemplateSelectors from '~/issuable/issuable_template_selectors';
|
||||
import { initWorkItemsRoot } from '~/work_items';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE } from '~/work_items/constants';
|
||||
|
||||
initForm();
|
||||
initWorkItemsRoot();
|
||||
|
||||
// eslint-disable-next-line no-new
|
||||
new IssuableTemplateSelectors({ warnTemplateOverride: true, editor: mountMarkdownEditor() });
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (gon.features.workItemsViewPreference || gon.features.workItemViewForIssues) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { issuableInitialDataById, isLegacyIssueType } from '~/issues/show/utils/issuable_data';
|
||||
import { WORK_ITEM_TYPE_NAME_ISSUE } from '~/work_items/constants';
|
||||
|
||||
const initLegacyIssuePage = async () => {
|
||||
const [{ initShow }] = await Promise.all([import('~/issues')]);
|
||||
|
@ -9,7 +8,7 @@ const initLegacyIssuePage = async () => {
|
|||
const initWorkItemPage = async () => {
|
||||
const [{ initWorkItemsRoot }] = await Promise.all([import('~/work_items')]);
|
||||
|
||||
initWorkItemsRoot({ workItemType: WORK_ITEM_TYPE_NAME_ISSUE });
|
||||
initWorkItemsRoot();
|
||||
};
|
||||
|
||||
const issuableData = issuableInitialDataById('js-issuable-app');
|
||||
|
|
|
@ -214,22 +214,6 @@ export const NEW_WORK_ITEM_IID = 'new-work-item-iid';
|
|||
export const NEW_WORK_ITEM_GID = 'gid://gitlab/WorkItem/new';
|
||||
export const NO_WORK_ITEM_IID = 'no-work-item-iid';
|
||||
|
||||
export const NEW_EPIC_FEEDBACK_PROMPT_EXPIRY = '2024-12-31';
|
||||
export const NEW_ISSUE_FEEDBACK_PROMPT_EXPIRY = '2025-04-25';
|
||||
export const FEATURE_NAME = 'work_item_epic_feedback';
|
||||
|
||||
export const ISSUE_WIT_FEEDBACK_BADGE = {
|
||||
feedbackIssue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/523713',
|
||||
feedbackIssueText: __('Provide feedback on the experience'),
|
||||
featureName: 'work_item_epic_feedback',
|
||||
badgeTitle: __('New look'),
|
||||
badgePopoverTitle: __('New look for issues and epics'),
|
||||
badgeContent: __(
|
||||
'We’ve introduced improvements to issues and epics such as the ability to view full details from within lists and boards, new features, and a refreshed design. Have questions or thoughts on the changes?',
|
||||
),
|
||||
expiry: '2025-04-25',
|
||||
};
|
||||
|
||||
export const DETAIL_VIEW_QUERY_PARAM_NAME = 'show';
|
||||
export const DETAIL_VIEW_DESIGN_VERSION_PARAM_NAME = 'version';
|
||||
export const ROUTES = {
|
||||
|
|
|
@ -8,7 +8,6 @@ import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
|
|||
import { parseBoolean } from '~/lib/utils/common_utils';
|
||||
import { injectVueAppBreadcrumbs } from '~/lib/utils/breadcrumbs';
|
||||
import { apolloProvider } from '~/graphql_shared/issuable_client';
|
||||
import { ISSUE_WIT_FEEDBACK_BADGE, WORK_ITEM_TYPE_NAME_ISSUE } from '~/work_items/constants';
|
||||
import App from './components/app.vue';
|
||||
import WorkItemBreadcrumb from './components/work_item_breadcrumb.vue';
|
||||
import activeDiscussionQuery from './components/design_management/graphql/client/active_design_discussion.query.graphql';
|
||||
|
@ -16,7 +15,7 @@ import { createRouter } from './router';
|
|||
|
||||
Vue.use(VueApollo);
|
||||
|
||||
export const initWorkItemsRoot = ({ workItemType, workspaceType, withTabs } = {}) => {
|
||||
export const initWorkItemsRoot = ({ workspaceType, withTabs } = {}) => {
|
||||
const el = document.querySelector('#js-work-items');
|
||||
|
||||
if (!el) {
|
||||
|
@ -47,7 +46,7 @@ export const initWorkItemsRoot = ({ workItemType, workspaceType, withTabs } = {}
|
|||
defaultBranch,
|
||||
initialSort,
|
||||
isSignedIn,
|
||||
workItemType: listWorkItemType,
|
||||
workItemType,
|
||||
hasEpicsFeature,
|
||||
showNewWorkItem,
|
||||
canCreateEpic,
|
||||
|
@ -68,7 +67,7 @@ export const initWorkItemsRoot = ({ workItemType, workspaceType, withTabs } = {}
|
|||
const router = createRouter({ fullPath, workspaceType, defaultBranch, isGroup });
|
||||
let listPath = issuesListPath;
|
||||
|
||||
const breadcrumbParams = { workItemType: listWorkItemType, isGroup };
|
||||
const breadcrumbParams = { workItemType, isGroup };
|
||||
|
||||
if (isGroup) {
|
||||
listPath = epicsListPath;
|
||||
|
@ -93,27 +92,6 @@ export const initWorkItemsRoot = ({ workItemType, workspaceType, withTabs } = {}
|
|||
},
|
||||
});
|
||||
|
||||
let feedback = {};
|
||||
|
||||
if (gon.features.workItemViewForIssues) {
|
||||
feedback = {
|
||||
...ISSUE_WIT_FEEDBACK_BADGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
workItemType === WORK_ITEM_TYPE_NAME_ISSUE &&
|
||||
gon.features.workItemsViewPreference &&
|
||||
!isGroup &&
|
||||
!gon.features.useWiViewForIssues
|
||||
) {
|
||||
import(/* webpackChunkName: 'work_items_feedback' */ '~/work_items_feedback')
|
||||
.then(({ initWorkItemsFeedback }) => {
|
||||
initWorkItemsFeedback(feedback);
|
||||
})
|
||||
.catch({});
|
||||
}
|
||||
|
||||
return new Vue({
|
||||
el,
|
||||
name: 'WorkItemsRoot',
|
||||
|
@ -141,7 +119,7 @@ export const initWorkItemsRoot = ({ workItemType, workspaceType, withTabs } = {}
|
|||
groupId,
|
||||
initialSort,
|
||||
isSignedIn: parseBoolean(isSignedIn),
|
||||
workItemType: listWorkItemType,
|
||||
workItemType,
|
||||
hasEpicsFeature: parseBoolean(hasEpicsFeature),
|
||||
showNewWorkItem: parseBoolean(showNewWorkItem),
|
||||
canCreateEpic: parseBoolean(canCreateEpic),
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
= render Pajamas::ButtonComponent.new(icon: 'sidebar', category: :tertiary, button_options: { class: 'js-super-sidebar-toggle-expand super-sidebar-toggle -gl-ml-3', aria: { controls: 'super-sidebar', expanded: 'false', label: _('Primary navigation sidebar') } })
|
||||
= render "layouts/nav/breadcrumbs/breadcrumbs"
|
||||
.gl-flex-none.gl-flex.gl-items-center.gl-justify-center.gl-gap-3
|
||||
= render "layouts/nav/work_items/feedback_badge"
|
||||
= render "layouts/nav/search_button"
|
||||
= render_if_exists "layouts/nav/ask_duo_button"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#js-work-item-feedback
|
|
@ -43,7 +43,25 @@ module Keeps
|
|||
|
||||
private
|
||||
|
||||
def parse_date(date_string)
|
||||
Date.parse(date_string)
|
||||
rescue Date::Error
|
||||
nil
|
||||
end
|
||||
|
||||
def can_remove_ff?(feature_flag, identifiers, latest_feature_flag_status)
|
||||
intended_to_rollout_by_date = feature_flag.intended_to_rollout_by
|
||||
if intended_to_rollout_by_date.present?
|
||||
rollout_date = parse_date(intended_to_rollout_by_date)
|
||||
if !rollout_date.nil? && rollout_date.future?
|
||||
@logger.puts "#{feature_flag.name} cannot be removed, intended rollout date is #{intended_to_rollout_by_date}"
|
||||
return false
|
||||
elsif rollout_date.nil?
|
||||
message = "#{feature_flag.name} intended_to_rollout_by #{intended_to_rollout_by_date}"
|
||||
@logger.puts "#{message}, is ignored as it cannot be parsed."
|
||||
end
|
||||
end
|
||||
|
||||
if feature_flag.milestone.nil?
|
||||
@logger.puts "#{feature_flag.name} has no milestone set!"
|
||||
return false
|
||||
|
@ -100,7 +118,7 @@ module Keeps
|
|||
It is possible that this MR will still need some changes to remove references to the feature flag in the code.
|
||||
At the moment the `gitlab-housekeeper` is not always capable of removing all references so you must check the diff and pipeline failures to confirm if there are any issues.
|
||||
It is the responsibility of ~"#{feature_flag.group}" to push those changes to this branch.
|
||||
If they are already removing this feature flag in another merge request then they can just close this merge request.
|
||||
If they are already removing this feature flag in another merge request then they can just close this merge request and add `intended_to_rollout_by` date in the yml file.
|
||||
|
||||
## TODO for the reviewers before merging this MR
|
||||
- [ ] See the status of the rollout by checking #{feature_flag_rollout_issue_url(feature_flag)}, #{format(FEATURE_FLAG_LOG_ISSUES_URL, feature_flag_name: feature_flag.name)}
|
||||
|
@ -297,7 +315,7 @@ module Keeps
|
|||
end
|
||||
|
||||
def all_feature_flag_files
|
||||
Dir.glob("{,ee/}config/feature_flags/{development,gitlab_com_derisk,ops,beta}/*.yml")
|
||||
Dir.glob("{,ee/}config/feature_flags/{development,gitlab_com_derisk,beta}/*.yml")
|
||||
end
|
||||
|
||||
def remove_feature_flag_prompts
|
||||
|
|
|
@ -98,6 +98,7 @@ module Feature
|
|||
type
|
||||
group
|
||||
default_enabled
|
||||
intended_to_rollout_by
|
||||
].freeze
|
||||
|
||||
def self.can_be_default_enabled?(feature_flag_type)
|
||||
|
|
|
@ -40383,9 +40383,6 @@ msgstr ""
|
|||
msgid "New epic"
|
||||
msgstr ""
|
||||
|
||||
msgid "New epic look"
|
||||
msgstr ""
|
||||
|
||||
msgid "New epic title"
|
||||
msgstr ""
|
||||
|
||||
|
@ -40439,9 +40436,6 @@ msgstr ""
|
|||
msgid "New look (Beta)"
|
||||
msgstr ""
|
||||
|
||||
msgid "New look for issues and epics"
|
||||
msgstr ""
|
||||
|
||||
msgid "New merge request"
|
||||
msgstr ""
|
||||
|
||||
|
@ -68736,15 +68730,9 @@ msgstr ""
|
|||
msgid "Welcome, %{name}!"
|
||||
msgstr ""
|
||||
|
||||
msgid "We’ve introduced improvements to issues and epics such as the ability to view full details from within lists and boards, new features, and a refreshed design. Have questions or thoughts on the changes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "We’ve introduced improvements to issues and epics, such as the ability to view full details from lists and boards, new features, and a refreshed design. Have questions or thoughts on the changes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "We’ve introduced some improvements to the epic page such as real time updates, additional features, and a refreshed design. Have questions or thoughts on the changes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "What are some examples?"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -57,14 +57,7 @@ module QA
|
|||
element 'work-item-title'
|
||||
end
|
||||
|
||||
view 'app/assets/javascripts/work_items_feedback/components/work_item_feedback.vue' do
|
||||
element 'work-item-feedback-popover'
|
||||
end
|
||||
|
||||
def edit_description(new_description)
|
||||
close_new_issue_popover if has_element?('work-item-feedback-popover')
|
||||
wait_for_requests
|
||||
|
||||
click_element('work-item-edit-form-button')
|
||||
|
||||
within_element('work-item-description-wrapper') do
|
||||
|
@ -94,17 +87,7 @@ module QA
|
|||
find_element('work-item-title').text.include?(title)
|
||||
end
|
||||
|
||||
def close_new_issue_popover
|
||||
within_element('work-item-feedback-popover') do
|
||||
click_element('close-button')
|
||||
end
|
||||
end
|
||||
|
||||
def open_actions_dropdown
|
||||
close_new_issue_popover if has_element?('work-item-feedback-popover')
|
||||
|
||||
wait_for_requests
|
||||
|
||||
click_element('work-item-actions-dropdown') unless has_element?('state-toggle-action', visible: true)
|
||||
end
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@ RSpec.describe 'unsupported work item types use legacy issue views', :js, featur
|
|||
expect(page).not_to have_selector('.work-item-view')
|
||||
# Legacy issue app rendered
|
||||
expect(page).to have_selector('.issuable-details')
|
||||
# Ensure the work item feedback badge is not rendered for unsupported types
|
||||
expect(page).not_to have_selector('[data-testid="work-item-feedback"]')
|
||||
expect(page).not_to have_content(/New issue look:/)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -81,9 +81,6 @@
|
|||
<div class="gl-flex gl-flex-none gl-items-center gl-justify-center">
|
||||
<div id="js-advanced-search-modal"></div>
|
||||
</div>
|
||||
<div class="gl-flex gl-grow gl-basis-0 gl-items-center gl-justify-end">
|
||||
<div id="js-work-item-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -64,7 +64,8 @@ RSpec.describe Keeps::DeleteOldFeatureFlags, feature_category: :tooling do
|
|||
rollout_issue_url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/123',
|
||||
default_enabled: false,
|
||||
group: groups.dig(:foo, :label),
|
||||
path: feature_flag_file
|
||||
path: feature_flag_file,
|
||||
intended_to_rollout_by: nil
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -88,7 +89,8 @@ RSpec.describe Keeps::DeleteOldFeatureFlags, feature_category: :tooling do
|
|||
rollout_issue_url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/123',
|
||||
default_enabled: false,
|
||||
group: groups.dig(:foo, :label),
|
||||
path: feature_flag_file
|
||||
path: feature_flag_file,
|
||||
intended_to_rollout_by: nil
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -142,7 +144,8 @@ RSpec.describe Keeps::DeleteOldFeatureFlags, feature_category: :tooling do
|
|||
rollout_issue_url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/123',
|
||||
default_enabled: true,
|
||||
group: groups.dig(:foo, :label),
|
||||
path: feature_flag_file
|
||||
path: feature_flag_file,
|
||||
intended_to_rollout_by: nil
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -184,6 +187,78 @@ RSpec.describe Keeps::DeleteOldFeatureFlags, feature_category: :tooling do
|
|||
expect(keep.send(:can_remove_ff?, feature_flag, identifiers, :disabled)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#parse_date' do
|
||||
it 'returns a date object for valid date strings' do
|
||||
expect(keep.send(:parse_date, '2023-01-01')).to eq(Date.new(2023, 1, 1))
|
||||
end
|
||||
|
||||
it 'returns nil for invalid date strings' do
|
||||
expect(keep.send(:parse_date, '2020')).to be_nil
|
||||
expect(keep.send(:parse_date, 'invalid')).to be_nil
|
||||
expect(keep.send(:parse_date, 'February 31, 2023')).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag has a future intended_to_rollout_by date' do
|
||||
let(:feature_flag) do
|
||||
instance_double(
|
||||
Feature::Definition,
|
||||
name: feature_flag_name,
|
||||
milestone: feature_flag_milestone,
|
||||
rollout_issue_url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/123',
|
||||
default_enabled: false,
|
||||
group: groups.dig(:foo, :label),
|
||||
path: feature_flag_file,
|
||||
intended_to_rollout_by: (Time.zone.today + 30).to_s
|
||||
)
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
expect(keep.send(:can_remove_ff?, feature_flag, identifiers, :enabled)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag has a past intended_to_rollout_by date' do
|
||||
let(:feature_flag) do
|
||||
instance_double(
|
||||
Feature::Definition,
|
||||
name: feature_flag_name,
|
||||
milestone: feature_flag_milestone,
|
||||
rollout_issue_url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/123',
|
||||
default_enabled: false,
|
||||
group: groups.dig(:foo, :label),
|
||||
path: feature_flag_file,
|
||||
intended_to_rollout_by: (Time.zone.today - 30).to_s
|
||||
)
|
||||
end
|
||||
|
||||
it 'returns true when other conditions are met' do
|
||||
expect(keep.send(:can_remove_ff?, feature_flag, identifiers, :enabled)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag has an invalid intended_to_rollout_by date' do
|
||||
let(:feature_flag) do
|
||||
instance_double(
|
||||
Feature::Definition,
|
||||
name: feature_flag_name,
|
||||
milestone: feature_flag_milestone,
|
||||
rollout_issue_url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/123',
|
||||
default_enabled: false,
|
||||
group: groups.dig(:foo, :label),
|
||||
path: feature_flag_file,
|
||||
intended_to_rollout_by: '2020'
|
||||
)
|
||||
end
|
||||
|
||||
# When parse_date returns nil for an invalid date, it passes through
|
||||
# the condition and allows removal
|
||||
it 'returns true when other conditions are met' do
|
||||
expect(keep.send(:parse_date, '2020')).to be_nil
|
||||
expect(keep.send(:can_remove_ff?, feature_flag, identifiers, :enabled)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#each_change' do
|
||||
|
|
Loading…
Reference in New Issue