From fd56a1433ea685e965f0430d754a1bc3f779587d Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2023 10:59:51 +0100 Subject: [PATCH] Removes moved_mr_sidebar flag This removes the moved_mr_sidebar feature flag Changelog: added --- .../components/board_content_sidebar.vue | 1 + .../diffs/components/diff_file_header.vue | 1 - .../diffs/components/diffs_file_tree.vue | 9 +- .../issues/show/components/header_actions.vue | 78 +++--- app/assets/javascripts/main.js | 10 +- app/assets/javascripts/merge_request_tabs.js | 8 +- .../components/sticky_header.vue | 2 +- .../notes/components/discussion_counter.vue | 2 +- app/assets/javascripts/right_sidebar.js | 24 +- .../components/lock/issuable_lock_form.vue | 57 +--- .../sidebar_subscriptions_widget.vue | 18 +- .../todo_toggle/sidebar_todo_widget.vue | 4 +- .../components/mr_more_dropdown.vue | 15 +- app/assets/stylesheets/framework/diffs.scss | 10 +- .../page_bundles/merge_requests.scss | 6 +- .../projects/incidents_controller.rb | 1 - app/controllers/projects/issues_controller.rb | 1 - .../projects/merge_requests_controller.rb | 1 - app/helpers/merge_requests_helper.rb | 4 - app/helpers/nav_helper.rb | 6 +- .../projects/merge_requests/_mr_box.html.haml | 2 +- .../merge_requests/_mr_title.html.haml | 7 +- .../projects/merge_requests/_page.html.haml | 38 +-- app/views/shared/issuable/_sidebar.html.haml | 35 +-- .../development/moved_mr_sidebar.yml | 8 - doc/user/discussions/index.md | 3 - doc/user/profile/notifications.md | 4 - doc/user/project/issues/managing_issues.md | 4 - .../components/epic_board_content_sidebar.vue | 1 + .../epic/components/epic_header_actions.vue | 21 +- .../epic/components/epic_sidebar.vue | 17 -- ee/app/controllers/groups/epics_controller.rb | 1 - .../epic_boards/epic_boards_sidebar_spec.rb | 5 +- ee/spec/features/epics/todo_spec.rb | 1 - ee/spec/features/issues/issue_sidebar_spec.rb | 2 - .../features/issues/related_issues_spec.rb | 2 - .../components/epic_header_actions_spec.js | 96 ++----- .../epic/components/epic_sidebar_spec.js | 14 - locale/gitlab.pot | 3 - spec/features/abuse_report_spec.rb | 1 - .../incidents/user_views_incident_spec.rb | 19 -- ...e_for_discussions_in_merge_request_spec.rb | 4 - spec/features/issues/discussion_lock_spec.rb | 258 +++++------------- spec/features/issues/issue_detail_spec.rb | 1 - spec/features/issues/issue_sidebar_spec.rb | 50 ---- .../issues/user_toggles_subscription_spec.rb | 25 +- .../merge_request/batch_comments_spec.rb | 10 +- .../close_reopen_report_toggle_spec.rb | 1 - .../merge_request_discussion_lock_spec.rb | 98 +------ .../user_manages_subscription_spec.rb | 47 +--- ...diff_notes_and_discussions_resolve_spec.rb | 58 ++-- .../user_views_open_merge_request_spec.rb | 19 -- .../show/components/header_actions_spec.js | 158 +---------- spec/frontend/merge_request_tabs_spec.js | 2 - .../lock/issuable_lock_form_spec.js | 137 +--------- .../sidebar_subscriptions_widget_spec.js | 54 +--- .../todo_toggle/sidebar_todo_widget_spec.js | 4 +- .../components/mr_more_dropdown_spec.js | 38 +-- .../features/sidebar_shared_examples.rb | 15 - 59 files changed, 283 insertions(+), 1238 deletions(-) delete mode 100644 config/feature_flags/development/moved_mr_sidebar.yml diff --git a/app/assets/javascripts/boards/components/board_content_sidebar.vue b/app/assets/javascripts/boards/components/board_content_sidebar.vue index 7929c1ad488e95..37f2d9ce45933a 100644 --- a/app/assets/javascripts/boards/components/board_content_sidebar.vue +++ b/app/assets/javascripts/boards/components/board_content_sidebar.vue @@ -296,6 +296,7 @@ export default { :iid="activeBoardIssuable.iid" :full-path="projectPathForActiveIssue" :issuable-type="issuableType" + :show-in-dropdown="false" data-testid="sidebar-notifications" /> diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 3dd52777267373..cbe1c541d1278c 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -286,7 +286,6 @@ export default { ref="header" :class="{ 'gl-z-dropdown-menu!': idState.moreActionsShown, - 'is-sidebar-moved': glFeatures.movedMrSidebar, }" class="js-file-title file-title file-title-flex-parent gl-border" data-testid="file-title-container" diff --git a/app/assets/javascripts/diffs/components/diffs_file_tree.vue b/app/assets/javascripts/diffs/components/diffs_file_tree.vue index 34cd901dd0c22b..06ea2676267243 100644 --- a/app/assets/javascripts/diffs/components/diffs_file_tree.vue +++ b/app/assets/javascripts/diffs/components/diffs_file_tree.vue @@ -4,7 +4,6 @@ import { mapActions, mapState } from 'vuex'; import { Mousetrap } from '~/lib/mousetrap'; import { keysFor, MR_TOGGLE_FILE_BROWSER } from '~/behaviors/shortcuts/keybindings'; import PanelResizer from '~/vue_shared/components/panel_resizer.vue'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { INITIAL_TREE_WIDTH, MIN_TREE_WIDTH, @@ -16,7 +15,6 @@ import TreeList from './tree_list.vue'; export default { name: 'DiffsFileTree', components: { TreeList, PanelResizer }, - mixins: [glFeatureFlagsMixin()], minTreeWidth: MIN_TREE_WIDTH, maxTreeWidth: window.innerWidth / 2, props: { @@ -60,12 +58,7 @@ export default { - + + - el.classList.toggle('gl-display-none!', action !== 'show'), - ); - } + this.expandSidebar?.forEach((el) => + el.classList.toggle('gl-display-none!', action !== 'show'), + ); if (action === 'commits') { if (!this.commitsLoaded) { diff --git a/app/assets/javascripts/merge_requests/components/sticky_header.vue b/app/assets/javascripts/merge_requests/components/sticky_header.vue index 5546e3d3d6381f..55a371837c995f 100644 --- a/app/assets/javascripts/merge_requests/components/sticky_header.vue +++ b/app/assets/javascripts/merge_requests/components/sticky_header.vue @@ -103,7 +103,7 @@ export default { return isLoggedIn(); }, isNotificationsTodosButtons() { - return this.glFeatures.notificationsTodosButtons && this.glFeatures.movedMrSidebar; + return this.glFeatures.notificationsTodosButtons; }, isForked() { return this.projectPath !== this.sourceProjectPath; diff --git a/app/assets/javascripts/notes/components/discussion_counter.vue b/app/assets/javascripts/notes/components/discussion_counter.vue index b392ad55fa28d7..9404fd04bc914d 100644 --- a/app/assets/javascripts/notes/components/discussion_counter.vue +++ b/app/assets/javascripts/notes/components/discussion_counter.vue @@ -72,7 +72,7 @@ export default { return options; }, isNotificationsTodosButtons() { - return this.glFeatures.notificationsTodosButtons && this.glFeatures.movedMrSidebar; + return this.glFeatures.notificationsTodosButtons; }, }, methods: { diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index bc1f32930e79ae..255171fdac2135 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -20,6 +20,8 @@ const updateSidebarClasses = (layoutPage, rightSidebar) => { function Sidebar() { this.sidebar = $('aside'); + this.isMR = /projects:merge_requests:/.test(document.body.dataset.page); + this.removeListeners(); this.addEventListeners(); } @@ -52,14 +54,12 @@ Sidebar.prototype.addEventListeners = function () { $document.on('click', '.js-sidebar-toggle', this.sidebarToggleClicked); - if (window.gon?.features?.movedMrSidebar) { - const layoutPage = document.querySelector('.layout-page'); - const rightSidebar = document.querySelector('.js-right-sidebar'); + const layoutPage = document.querySelector('.layout-page'); + const rightSidebar = document.querySelector('.js-right-sidebar'); - if (rightSidebar.classList.contains('right-sidebar-merge-requests')) { - updateSidebarClasses(layoutPage, rightSidebar); - window.addEventListener('resize', () => updateSidebarClasses(layoutPage, rightSidebar)); - } + if (rightSidebar.classList.contains('right-sidebar-merge-requests')) { + updateSidebarClasses(layoutPage, rightSidebar); + window.addEventListener('resize', () => updateSidebarClasses(layoutPage, rightSidebar)); } }; @@ -79,7 +79,10 @@ Sidebar.prototype.sidebarToggleClicked = function (e, triggered) { $('aside.right-sidebar') .removeClass('right-sidebar-expanded') .addClass('right-sidebar-collapsed'); - $('.layout-page').removeClass('right-sidebar-expanded').addClass('right-sidebar-collapsed'); + + if (!this.isMR) { + $('.layout-page').removeClass('right-sidebar-expanded').addClass('right-sidebar-collapsed'); + } } else { $toggleContainer.data('is-expanded', true); $expandIcon.addClass('hidden'); @@ -87,7 +90,10 @@ Sidebar.prototype.sidebarToggleClicked = function (e, triggered) { $('aside.right-sidebar') .removeClass('right-sidebar-collapsed') .addClass('right-sidebar-expanded'); - $('.layout-page').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); + + if (!this.isMR) { + $('.layout-page').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); + } } $toggleButtons.attr('data-original-title', tooltipLabel); diff --git a/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue b/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue index 977d1d6f668fcd..6c4eb955dbf0bb 100644 --- a/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue +++ b/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue @@ -1,6 +1,5 @@ diff --git a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue index 866db2a43b8f79..204425fae70f3b 100644 --- a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue +++ b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue @@ -13,8 +13,8 @@ import { isLoggedIn } from '~/lib/utils/common_utils'; import { __, sprintf } from '~/locale'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import toast from '~/vue_shared/plugins/global_toast'; -import { Tracking } from '../../constants'; import { subscribedQueries } from '../../queries/constants'; +import { Tracking } from '../../constants'; import SidebarEditableItem from '../sidebar_editable_item.vue'; const ICON_ON = 'notifications'; @@ -51,6 +51,11 @@ export default { required: true, type: String, }, + showInDropdown: { + required: false, + type: Boolean, + default: true, + }, }, data() { return { @@ -95,9 +100,6 @@ export default { }, }, computed: { - isMovedMrSidebar() { - return this.glFeatures.movedMrSidebar; - }, isIssuable() { return this.issuableType === TYPE_ISSUE; }, @@ -131,7 +133,7 @@ export default { return this.emailsDisabled || !this.isLoggedIn; }, isNotificationsTodosButtons() { - return this.glFeatures.notificationsTodosButtons && this.glFeatures.movedMrSidebar; + return this.glFeatures.notificationsTodosButtons; }, isMergeRequest() { return this.issuableType === 'merge_request'; @@ -161,9 +163,7 @@ export default { }); } - if (this.isMovedMrSidebar) { - toast(subscribed ? __('Notifications turned on.') : __('Notifications turned off.')); - } + toast(subscribed ? __('Notifications turned on.') : __('Notifications turned off.')); }, ) .catch(() => { @@ -201,7 +201,7 @@ export default { - + - + 'polite', 'aria-label': issuable_type } - .issuable-sidebar{ class: "#{'is-merge-request' if is_merge_request_with_flag}" } - .issuable-sidebar-header{ class: "#{'gl-pb-2! gl-md-display-flex gl-justify-content-end gl-lg-display-none!' if is_merge_request_with_flag}" } - = render Pajamas::ButtonComponent.new(button_options: { class: "gutter-toggle float-right js-sidebar-toggle has-tooltip gl-shadow-none! #{'gl-display-block' if moved_sidebar_enabled} #{'gl-mt-2' if notifications_todos_buttons_enabled?}" , type: 'button', 'aria-label' => _('Toggle sidebar'), title: sidebar_gutter_tooltip_text, data: { container: 'body', placement: 'left', boundary: 'viewport' } }) do +%aside.right-sidebar.js-right-sidebar.js-issuable-sidebar{ data: { always_show_toggle: true, signed: { in: signed_in }, issuable_type: issuable_type }, class: "#{sidebar_gutter_collapsed_class(is_merge_request)} #{'right-sidebar-merge-requests' if is_merge_request}", 'aria-live' => 'polite', 'aria-label': issuable_type } + .issuable-sidebar{ class: "#{'is-merge-request' if is_merge_request}" } + .issuable-sidebar-header{ class: "#{'gl-pb-2! gl-md-display-flex gl-justify-content-end gl-lg-display-none!' if is_merge_request}" } + = render Pajamas::ButtonComponent.new(button_options: { class: "gutter-toggle float-right js-sidebar-toggle has-tooltip gl-shadow-none! gl-display-block #{'gl-mt-2' if notifications_todos_buttons_enabled?}" , type: 'button', 'aria-label' => _('Toggle sidebar'), title: sidebar_gutter_tooltip_text, data: { container: 'body', placement: 'left', boundary: 'viewport' } }) do = sidebar_gutter_toggle_icon - if signed_in - - if !is_merge_request_with_flag + - if !is_merge_request .js-sidebar-todo-widget-root{ data: { project_path: issuable_sidebar[:project_full_path], iid: issuable_sidebar[:iid], id: issuable_sidebar[:id] } } - if notifications_todos_buttons_enabled? .js-sidebar-subscriptions-widget-root = form_for issuable_type, url: issuable_sidebar[:issuable_json_path], remote: true, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f| - .block.assignee{ class: "#{'gl-mt-3' if !signed_in && moved_sidebar_enabled}", data: { testid: 'assignee-block-container' } } + .block.assignee{ class: "#{'gl-mt-3' if !signed_in}", data: { testid: 'assignee-block-container' } } = render "shared/issuable/sidebar_assignees", issuable_sidebar: issuable_sidebar, assignees: assignees, signed_in: signed_in - if issuable_sidebar[:supports_severity] @@ -79,28 +76,8 @@ = render_if_exists 'shared/issuable/sidebar_cve_id_request', issuable_sidebar: issuable_sidebar - - if !moved_sidebar_enabled - .js-sidebar-lock-root - - if signed_in - .js-sidebar-subscriptions-widget-root - .js-sidebar-participants-widget-root - - if !moved_sidebar_enabled - .block.with-sub-blocks - .js-sidebar-reference-widget-root - - if is_merge_request && !moved_sidebar_enabled - .sub-block.js-sidebar-source-branch - .sidebar-collapsed-icon.js-dont-change-state - = clipboard_button(text: source_branch, title: _('Copy branch name'), placement: "left", boundary: 'viewport', class: 'js-source-branch-copy') - .gl-display-flex.gl-align-items-center.gl-justify-content-space-between.gl-mb-2.hide-collapsed - %span.gl-overflow-hidden.gl-text-overflow-ellipsis.gl-white-space-nowrap - = _('Source branch: %{source_branch_open}%{source_branch}%{source_branch_close}').html_safe % { source_branch_open: "".html_safe, source_branch_close: "".html_safe, source_branch: html_escape(source_branch) } - = clipboard_button(text: source_branch, title: _('Copy branch name'), placement: "left", boundary: 'viewport', class: 'js-source-branch-copy') - - - if show_forwarding_email && !moved_sidebar_enabled - .block - .js-sidebar-copy-email-root - if issuable_sidebar.dig(:current_user, :can_move) .block .js-sidebar-move-issue-block{ data: { project_full_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid] } } diff --git a/config/feature_flags/development/moved_mr_sidebar.yml b/config/feature_flags/development/moved_mr_sidebar.yml deleted file mode 100644 index 0a54e51e57f1fe..00000000000000 --- a/config/feature_flags/development/moved_mr_sidebar.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: moved_mr_sidebar -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85584 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/385460 -milestone: '14.10' -type: development -group: group::code review -default_enabled: true diff --git a/doc/user/discussions/index.md b/doc/user/discussions/index.md index dfcbc8a171db5f..95e694f0191d6f 100644 --- a/doc/user/discussions/index.md +++ b/doc/user/discussions/index.md @@ -169,9 +169,6 @@ A system note is added to the page details. If an issue or merge request is closed with a locked discussion, then you cannot reopen it until the discussion is unlocked. - -If you don't see this action on the right sidebar, your project or instance might have [moved sidebar actions](../project/merge_requests/index.md#move-sidebar-actions) enabled. - ## Add an internal note > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207473) in GitLab 13.9 [with a flag](../../administration/feature_flags.md) named `confidential_notes`. Disabled by default. diff --git a/doc/user/profile/notifications.md b/doc/user/profile/notifications.md index c7b2de3ce7f559..bc3bfb36349156 100644 --- a/doc/user/profile/notifications.md +++ b/doc/user/profile/notifications.md @@ -213,10 +213,6 @@ When you **turn off** notifications, you stop receiving notifications for update Turning this toggle off only unsubscribes you from updates related to this issue, merge request, or epic. Learn how to [opt out of all emails from GitLab](#opt-out-of-all-gitlab-emails). - -If you don't see this action on the right sidebar, your project or instance might have -enabled a feature flag for [moved sidebar actions](../project/merge_requests/index.md#move-sidebar-actions). - ### Notification events on issues, merge requests, and epics The following table presents the events that generate notifications for issues, merge requests, and diff --git a/doc/user/project/issues/managing_issues.md b/doc/user/project/issues/managing_issues.md index 62d108d354048b..b4287bc31df3ca 100644 --- a/doc/user/project/issues/managing_issues.md +++ b/doc/user/project/issues/managing_issues.md @@ -506,10 +506,6 @@ You can now paste the reference into another description or comment. Read more about issue references in [GitLab-Flavored Markdown](../../markdown.md#gitlab-specific-references). - -If you don't see this action on the right sidebar, your project or instance might have -enabled a feature flag for [moved actions](../merge_requests/index.md#move-sidebar-actions). - ## Copy issue email address > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18816) in GitLab 13.8. diff --git a/ee/app/assets/javascripts/boards/components/epic_board_content_sidebar.vue b/ee/app/assets/javascripts/boards/components/epic_board_content_sidebar.vue index ce3930efce2e51..c303762f60b2f4 100644 --- a/ee/app/assets/javascripts/boards/components/epic_board_content_sidebar.vue +++ b/ee/app/assets/javascripts/boards/components/epic_board_content_sidebar.vue @@ -163,6 +163,7 @@ export default { :iid="activeBoardCard.iid" :full-path="fullPath" :issuable-type="issuableType" + :show-in-dropdown="false" /> diff --git a/ee/app/assets/javascripts/epic/components/epic_header_actions.vue b/ee/app/assets/javascripts/epic/components/epic_header_actions.vue index 0a27a6799a8422..41f83f4bf29f2a 100644 --- a/ee/app/assets/javascripts/epic/components/epic_header_actions.vue +++ b/ee/app/assets/javascripts/epic/components/epic_header_actions.vue @@ -66,17 +66,8 @@ export default { actionButtonText() { return this.isEpicOpen ? __('Close epic') : __('Reopen epic'); }, - isMrSidebarMoved() { - return this.glFeatures.movedMrSidebar; - }, - showDesktopDropdown() { - return this.canCreate || this.canDestroy || this.isMrSidebarMoved; - }, - showMobileDropdown() { - return this.showDesktopDropdown || this.canUpdate; - }, showNotificationToggle() { - return this.isMrSidebarMoved && isLoggedIn(); + return isLoggedIn(); }, newEpicDropdownItem() { return { @@ -124,9 +115,7 @@ export default { items.push(this.toggleEpicStatusDropdownItem); } - if (this.isMrSidebarMoved) { - items.push(this.copyReferenceDropdownItem); - } + items.push(this.copyReferenceDropdownItem); return { items }; }, @@ -141,9 +130,7 @@ export default { items.push(this.newEpicDropdownItem); } - if (this.isMrSidebarMoved) { - items.push(this.copyReferenceDropdownItem); - } + items.push(this.copyReferenceDropdownItem); return { items }; }, @@ -186,7 +173,6 @@ export default { diff --git a/ee/app/controllers/groups/epics_controller.rb b/ee/app/controllers/groups/epics_controller.rb index 048ecb0f322fa5..26f851e20813f9 100644 --- a/ee/app/controllers/groups/epics_controller.rb +++ b/ee/app/controllers/groups/epics_controller.rb @@ -19,7 +19,6 @@ class Groups::EpicsController < Groups::ApplicationController before_action do push_frontend_feature_flag(:epic_color_highlight, @group) push_frontend_feature_flag(:preserve_unchanged_markdown, @group) - push_frontend_feature_flag(:moved_mr_sidebar, @project) push_frontend_feature_flag(:or_issuable_queries, @group) push_frontend_feature_flag(:notifications_todos_buttons, current_user) end diff --git a/ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb b/ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb index 7377c48c6c06c8..fdbed10e06f772 100644 --- a/ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb +++ b/ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb @@ -182,10 +182,7 @@ it 'displays notifications toggle', :aggregate_failures do click_card(card) - page.within('.subscriptions') do - expect(page).to have_selector('[data-testid="subscription-toggle"]') - expect(page).not_to have_content('Disabled by group owner') - end + expect(page).to have_selector('[data-testid="subscription-toggle"]') end it 'shows toggle as on then as off as user toggles to subscribe and unsubscribe', :aggregate_failures do diff --git a/ee/spec/features/epics/todo_spec.rb b/ee/spec/features/epics/todo_spec.rb index 4eacde78d69a67..b422c938491366 100644 --- a/ee/spec/features/epics/todo_spec.rb +++ b/ee/spec/features/epics/todo_spec.rb @@ -55,7 +55,6 @@ context 'with notifications_todos_buttons feature flag enabled' do before do stub_licensed_features(epics: true) - stub_feature_flags(moved_mr_sidebar: true) stub_feature_flags(notifications_todos_buttons: true) sign_in(user) diff --git a/ee/spec/features/issues/issue_sidebar_spec.rb b/ee/spec/features/issues/issue_sidebar_spec.rb index 832908596a826b..762b22506e6fce 100644 --- a/ee/spec/features/issues/issue_sidebar_spec.rb +++ b/ee/spec/features/issues/issue_sidebar_spec.rb @@ -16,7 +16,6 @@ before do sign_in(user) - stub_feature_flags(moved_mr_sidebar: false) end context 'for Assignees', :js do @@ -114,7 +113,6 @@ context 'when health status feature is available' do before do stub_licensed_features(issuable_health_status: true) - stub_feature_flags(moved_mr_sidebar: false) visit_issue(project, issue) end diff --git a/ee/spec/features/issues/related_issues_spec.rb b/ee/spec/features/issues/related_issues_spec.rb index e0fe4df9dd398c..12e05cf8d51304 100644 --- a/ee/spec/features/issues/related_issues_spec.rb +++ b/ee/spec/features/issues/related_issues_spec.rb @@ -100,7 +100,6 @@ def add_linked_issue(issue, radio_input_value) context 'when clicking the top `Close issue` button in the issue header', :aggregate_failures do it 'shows a modal to confirm closing the issue' do # Workaround for modal not showing when issue is first added - stub_feature_flags(moved_mr_sidebar: false) visit project_issue_path(project, issue_a) wait_for_requests @@ -127,7 +126,6 @@ def add_linked_issue(issue, radio_input_value) context 'when clicking the bottom `Close issue` button below the comment textarea', :aggregate_failures do it 'shows a modal to confirm closing the issue' do # Workaround for modal not showing when issue is first added - stub_feature_flags(moved_mr_sidebar: false) visit project_issue_path(project, issue_a) wait_for_requests diff --git a/ee/spec/frontend/epic/components/epic_header_actions_spec.js b/ee/spec/frontend/epic/components/epic_header_actions_spec.js index 3cf070a111b18b..e301c36ff62ab8 100644 --- a/ee/spec/frontend/epic/components/epic_header_actions_spec.js +++ b/ee/spec/frontend/epic/components/epic_header_actions_spec.js @@ -23,11 +23,7 @@ describe('EpicHeaderActions component', () => { isEpicAuthor: jest.fn(() => false), }; - const createComponent = ({ - isLoggedIn = true, - isMoveSidebarEnabled = false, - state = {}, - } = {}) => { + const createComponent = ({ isLoggedIn = true, state = {} } = {}) => { const { getters, ...storeConfig } = getStoreConfig(); store = new Vuex.Store({ ...storeConfig, @@ -50,9 +46,6 @@ describe('EpicHeaderActions component', () => { fullPath: 'mock-path', iid: 'mock-iid', reportAbusePath: '/report/abuse/path', - glFeatures: { - movedMrSidebar: isMoveSidebarEnabled, - }, }, }); }; @@ -70,9 +63,6 @@ describe('EpicHeaderActions component', () => { const findNotificationToggle = () => wrapper.findComponent(SidebarSubscriptionsWidget); const findReopenEpicButton = () => wrapper.findByRole('button', { name: 'Reopen epic' }); - const findActionsDropdownMobile = () => wrapper.findByTestId('actions-dropdown-mobile'); - const findActionsDropdownDesktop = () => wrapper.findByTestId('actions-dropdown-desktop'); - const findReportAbuseButton = () => wrapper.findByRole('button', { name: 'Report abuse to administrator' }); const findAbuseCategorySelector = () => wrapper.findComponent(AbuseCategorySelector); @@ -148,79 +138,29 @@ describe('EpicHeaderActions component', () => { }); }); - describe('moved_mr_sidebar feature flag', () => { - describe('when the flag is off', () => { - beforeEach(() => { - createComponent({ isMoveSidebarEnabled: false }); - }); - - it('does not render notification toggle', () => { - expect(findNotificationToggle().exists()).toBe(false); - }); - - it('does not render the copy reference dropdown item', () => { - expect(findCopyReferenceDropdownItem().exists()).toBe(false); - }); - - it('does not pass bordered property to actions dropdown', () => { - expect(findActionsDropdownMobile().props('bordered')).toBe(false); - expect(findActionsDropdownDesktop().props('bordered')).toBe(false); + describe('when logged out', () => { + beforeEach(() => { + createComponent({ + isLoggedIn: false, + state: { + canCreate: false, + canDestroy: false, + canUpdate: false, + }, }); }); - describe('when the flag is on', () => { - beforeEach(() => { - createComponent({ isMoveSidebarEnabled: true }); - }); - - it('renders the notification toggle', () => { - expect(findNotificationToggle().exists()).toBe(true); - }); - - it('renders the copy reference dropdown item', () => { - expect(findCopyReferenceDropdownItem().exists()).toBe(true); - }); + it('shows actions dropdown', () => { + expect(findDropdown().exists()).toBe(true); + }); - it('pass bordered property to actions dropdown', () => { - expect(findActionsDropdownMobile().props('bordered')).toBe(true); - expect(findActionsDropdownDesktop().props('bordered')).toBe(true); - }); + it('shows "Copy reference" dropdown item', () => { + expect(findCopyReferenceDropdownItem().exists()).toBe(true); }); - }); - describe('when logged out', () => { - describe.each` - movedMrSidebarEnabled | headerActionsVisible - ${true} | ${true} - ${false} | ${false} - `( - `when movedMrSidebar feature flag is "$movedMrSidebarEnabled"`, - ({ movedMrSidebarEnabled, headerActionsVisible }) => { - beforeEach(() => { - createComponent({ - isLoggedIn: false, - isMoveSidebarEnabled: movedMrSidebarEnabled, - state: { - canCreate: false, - canDestroy: false, - canUpdate: false, - }, - }); - }); - - it(`${headerActionsVisible ? 'shows' : 'hides'} actions dropdown`, () => { - expect(findDropdown().exists()).toBe(headerActionsVisible); - }); - - it(`${headerActionsVisible ? 'shows' : 'hides'} "Copy reference" dropdown item`, () => { - expect(findCopyReferenceDropdownItem().exists()).toBe(headerActionsVisible); - }); - - it('does not show notification toggle', () => { - expect(findNotificationToggle().exists()).toBe(false); - }); - }, - ); + it('does not show notification toggle', () => { + expect(findNotificationToggle().exists()).toBe(false); + }); }); }); diff --git a/ee/spec/frontend/epic/components/epic_sidebar_spec.js b/ee/spec/frontend/epic/components/epic_sidebar_spec.js index 42c845d74e6fbb..4f42aa1e2d3550 100644 --- a/ee/spec/frontend/epic/components/epic_sidebar_spec.js +++ b/ee/spec/frontend/epic/components/epic_sidebar_spec.js @@ -10,8 +10,6 @@ import SidebarAncestorsWidget from 'ee_component/sidebar/components/ancestors_tr import LabelsSelectWidget from '~/sidebar/components/labels/labels_select_widget/labels_select_root.vue'; import SidebarParticipantsWidget from '~/sidebar/components/participants/sidebar_participants_widget.vue'; -import SidebarReferenceWidget from '~/sidebar/components/copy/sidebar_reference_widget.vue'; -import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue'; import { parsePikadayDate } from '~/lib/utils/datetime_utility'; @@ -94,10 +92,6 @@ describe('EpicSidebarComponent', () => { expect(wrapper.findComponent(LabelsSelectWidget).exists()).toBe(true); }); - it('renders SidebarSubscriptionsWidget', () => { - expect(wrapper.findComponent(SidebarSubscriptionsWidget).exists()).toBe(true); - }); - it('renders SidebarTodoWidget when user is signed in', () => { const todoWidget = wrapper.findComponent(SidebarTodoWidget); expect(todoWidget.exists()).toBe(true); @@ -109,10 +103,6 @@ describe('EpicSidebarComponent', () => { }); }); - it('renders SidebarReferenceWidget', () => { - expect(wrapper.findComponent(SidebarReferenceWidget).exists()).toBe(true); - }); - describe('when sub-epics feature is not available', () => { it('does not renders ancestors list', async () => { store.dispatch('setEpicMeta', { @@ -135,10 +125,6 @@ describe('EpicSidebarComponent', () => { it('renders participants widget', () => { expect(wrapper.findComponent(SidebarParticipantsWidget).exists()).toBe(true); }); - - it('renders subscription toggle element', () => { - expect(wrapper.findComponent(SidebarSubscriptionsWidget).exists()).toBe(true); - }); }); describe('when user is not signed in', () => { diff --git a/locale/gitlab.pot b/locale/gitlab.pot index c1b1daf08e96ee..5466174e8111da 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -47228,9 +47228,6 @@ msgstr "" msgid "Source branch will not be deleted." msgstr "" -msgid "Source branch: %{source_branch_open}%{source_branch}%{source_branch_close}" -msgstr "" - msgid "Source code (%{fileExtension})" msgstr "" diff --git a/spec/features/abuse_report_spec.rb b/spec/features/abuse_report_spec.rb index eac29b0b7412c9..407a0507c95b35 100644 --- a/spec/features/abuse_report_spec.rb +++ b/spec/features/abuse_report_spec.rb @@ -12,7 +12,6 @@ before do sign_in(reporter1) - stub_feature_flags(moved_mr_sidebar: false) end describe 'report abuse to administrator' do diff --git a/spec/features/incidents/user_views_incident_spec.rb b/spec/features/incidents/user_views_incident_spec.rb index 65bd88582db5ce..e433ce120d7387 100644 --- a/spec/features/incidents/user_views_incident_spec.rb +++ b/spec/features/incidents/user_views_incident_spec.rb @@ -18,7 +18,6 @@ before do sign_in(user) - stub_feature_flags(moved_mr_sidebar: false) visit(incident_project_issues_path(project, incident)) end @@ -48,14 +47,6 @@ context 'when user is guest' do let(:user) { guest } - context 'and author' do - let(:author) { guest } - - it 'does not show the incident actions', :js do - expect(page).not_to have_button('Incident actions') - end - end - context 'and not author' do it 'shows incident actions', :js do click_button 'Incident actions' @@ -65,14 +56,4 @@ end end end - - context 'when the project is archived' do - before_all do - project.update!(archived: true) - end - - it 'does not show the incident actions', :js do - expect(page).not_to have_button('Incident actions') - end - end end diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index a671edb3cebc18..0096102a0420fd 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -18,10 +18,6 @@ def resolve_all_discussions_link_selector(title: "") end end - before do - stub_feature_flags(moved_mr_sidebar: false) - end - describe 'as a user with access to the project' do before do project.add_maintainer(user) diff --git a/spec/features/issues/discussion_lock_spec.rb b/spec/features/issues/discussion_lock_spec.rb index 2ef912061e690a..6b955ced06e60c 100644 --- a/spec/features/issues/discussion_lock_spec.rb +++ b/spec/features/issues/discussion_lock_spec.rb @@ -11,235 +11,111 @@ let(:locked_badge) { '[data-testid="locked-badge"]' } let(:issuable_note_warning) { '[data-testid="issuable-note-warning"]' } - context 'when feature flag is disabled' do + before do + sign_in(user) + end + + context 'when a user is a team member' do before do - sign_in(user) - stub_feature_flags(moved_mr_sidebar: false) + project.add_developer(user) end - context 'when a user is a team member' do - before do - project.add_developer(user) - end - - context 'when the discussion is unlocked' do - it 'the user can lock the issue' do - visit project_issue_path(project, issue) - - expect(find('.issuable-sidebar')).to have_content('Unlocked') - - page.within('.issuable-sidebar') do - find('.lock-edit').click - click_button('Lock') - end - - expect(find('#notes')).to have_content('locked the discussion in this issue') - end - end - - context 'when the discussion is locked' do - before do - issue.update_attribute(:discussion_locked, true) - visit project_issue_path(project, issue) - end - - it 'the user can unlock the issue' do - expect(find('.issuable-sidebar')).to have_content('Locked') - - page.within('.issuable-sidebar') do - find('.lock-edit').click - click_button('Unlock') - end - - expect(find('#notes')).to have_content('unlocked the discussion in this issue') - expect(find('.issuable-sidebar')).to have_content('Unlocked') - end - - it 'the user can create a comment' do - page.within('#notes .js-main-target-form') do - fill_in 'note[note]', with: 'Some new comment' - click_button 'Comment' - end + context 'when the discussion is unlocked' do + it 'the user can lock the issue' do + visit project_issue_path(project, issue) - wait_for_requests + more_dropdown.click + expect(issuable_lock).to have_content('Lock discussion') - expect(find('div#notes')).to have_content('Some new comment') - end + issuable_lock.click + expect(find('#notes')).to have_content('locked the discussion in this issue') end end - context 'when a user is not a team member' do - context 'when the discussion is unlocked' do - before do - visit project_issue_path(project, issue) - end - - it 'the user can not lock the issue' do - expect(find('.issuable-sidebar')).to have_content('Unlocked') - expect(find('.issuable-sidebar')).not_to have_selector('.lock-edit') - end - - it 'the user can create a comment' do - page.within('#notes .js-main-target-form') do - fill_in 'note[note]', with: 'Some new comment' - click_button 'Comment' - end + context 'when the discussion is locked' do + before do + issue.update_attribute(:discussion_locked, true) + visit project_issue_path(project, issue) + end - wait_for_requests + it 'the user can unlock the issue' do + more_dropdown.click + expect(issuable_lock).to have_content('Unlock discussion') - expect(find('div#notes')).to have_content('Some new comment') - end + issuable_lock.click + expect(find('#notes')).to have_content('unlocked the discussion in this issue') + expect(issuable_lock).to have_content('Lock discussion') end - context 'when the discussion is locked' do - before do - issue.update_attribute(:discussion_locked, true) - visit project_issue_path(project, issue) + it 'the user can create a comment' do + page.within('#notes .js-main-target-form') do + fill_in 'note[note]', with: 'Some new comment' + click_button 'Comment' end - it 'the user can not unlock the issue' do - expect(find('.issuable-sidebar')).to have_content('Locked') - expect(find('.issuable-sidebar')).not_to have_selector('.lock-edit') - end + wait_for_requests - it 'the user can not create a comment' do - page.within('#notes') do - expect(page).not_to have_selector('.js-main-target-form') - expect(find_by_testid('disabled-comments')) - .to have_content('The discussion in this issue is locked. Only project members can comment.') - end - end - end - end - - context 'for axe automated accessibility testing' do - before do - project.add_developer(user) - issue.update_attribute(:discussion_locked, true) - visit project_issue_path(project, issue) - end - - it 'passes tests' do - # rubocop:disable Capybara/TestidFinders -- within_testid does not work here - expect(page).to be_axe_clean.within(locked_badge) - expect(page).to be_axe_clean.within(issuable_note_warning) - # rubocop:enable Capybara/TestidFinders - page.within('.issuable-sidebar') do - find('.lock-edit').click - expect(page).to be_axe_clean.within('.lock-edit') - end + expect(find('div#notes')).to have_content('Some new comment') end end end - context 'when feature flag is enabled' do - before do - sign_in(user) - stub_feature_flags(moved_mr_sidebar: true) - end - - context 'when a user is a team member' do + context 'when a user is not a team member' do + context 'when the discussion is unlocked' do before do - project.add_developer(user) + visit project_issue_path(project, issue) end - context 'when the discussion is unlocked' do - it 'the user can lock the issue' do - visit project_issue_path(project, issue) - - more_dropdown.click - expect(issuable_lock).to have_content('Lock discussion') - - issuable_lock.click - expect(find('#notes')).to have_content('locked the discussion in this issue') - end + it 'the user can not lock the issue' do + more_dropdown.click + expect(issuable_lock).to have_content('Lock discussion') end - context 'when the discussion is locked' do - before do - issue.update_attribute(:discussion_locked, true) - visit project_issue_path(project, issue) - end - - it 'the user can unlock the issue' do - more_dropdown.click - expect(issuable_lock).to have_content('Unlock discussion') - - issuable_lock.click - expect(find('#notes')).to have_content('unlocked the discussion in this issue') - expect(issuable_lock).to have_content('Lock discussion') + it 'the user can create a comment' do + page.within('#notes .js-main-target-form') do + fill_in 'note[note]', with: 'Some new comment' + click_button 'Comment' end - it 'the user can create a comment' do - page.within('#notes .js-main-target-form') do - fill_in 'note[note]', with: 'Some new comment' - click_button 'Comment' - end + wait_for_requests - wait_for_requests - - expect(find('div#notes')).to have_content('Some new comment') - end + expect(find('div#notes')).to have_content('Some new comment') end end - context 'when a user is not a team member' do - context 'when the discussion is unlocked' do - before do - visit project_issue_path(project, issue) - end - - it 'the user can not lock the issue' do - more_dropdown.click - expect(issuable_lock).to have_content('Lock discussion') - end - - it 'the user can create a comment' do - page.within('#notes .js-main-target-form') do - fill_in 'note[note]', with: 'Some new comment' - click_button 'Comment' - end - - wait_for_requests - - expect(find('div#notes')).to have_content('Some new comment') - end + context 'when the discussion is locked' do + before do + issue.update_attribute(:discussion_locked, true) + visit project_issue_path(project, issue) end - context 'when the discussion is locked' do - before do - issue.update_attribute(:discussion_locked, true) - visit project_issue_path(project, issue) - end - - it 'the user can not unlock the issue' do - more_dropdown.click - expect(issuable_lock).to have_content('Unlock discussion') - end + it 'the user can not unlock the issue' do + more_dropdown.click + expect(issuable_lock).to have_content('Unlock discussion') + end - it 'the user can not create a comment' do - page.within('#notes') do - expect(page).not_to have_selector('js-main-target-form') - expect(find_by_testid('disabled-comments')) - .to have_content('The discussion in this issue is locked. Only project members can comment.') - end + it 'the user can not create a comment' do + page.within('#notes') do + expect(page).not_to have_selector('js-main-target-form') + expect(find_by_testid('disabled-comments')) + .to have_content('The discussion in this issue is locked. Only project members can comment.') end end end + end - it 'passes axe automated accessibility testing' do - project.add_developer(user) - issue.update_attribute(:discussion_locked, true) - visit project_issue_path(project, issue) - wait_for_all_requests + it 'passes axe automated accessibility testing' do + project.add_developer(user) + issue.update_attribute(:discussion_locked, true) + visit project_issue_path(project, issue) + wait_for_all_requests - # rubocop:disable Capybara/TestidFinders -- within_testid does not work here - expect(page).to be_axe_clean.within(locked_badge) - expect(page).to be_axe_clean.within(issuable_note_warning) + # rubocop:disable Capybara/TestidFinders -- within_testid does not work here + expect(page).to be_axe_clean.within(locked_badge) + expect(page).to be_axe_clean.within(issuable_note_warning) - more_dropdown.click - expect(page).to be_axe_clean.within('[data-testid="lock-issue-toggle"] button') - # rubocop:enable Capybara/TestidFinders - end + more_dropdown.click + expect(page).to be_axe_clean.within('[data-testid="lock-issue-toggle"] button') + # rubocop:enable Capybara/TestidFinders end end diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb index 15cb1678c5522f..230365e4faf5cb 100644 --- a/spec/features/issues/issue_detail_spec.rb +++ b/spec/features/issues/issue_detail_spec.rb @@ -98,7 +98,6 @@ project.add_developer(user_to_be_deleted) sign_in(user_to_be_deleted) - stub_feature_flags(moved_mr_sidebar: false) visit project_issue_path(project, issue) wait_for_requests diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 1a51dd0bc0175e..8f8df18408af77 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -91,7 +91,6 @@ context 'as an allowed user' do before do - stub_feature_flags(moved_mr_sidebar: false) project.add_developer(user) visit_issue(project, issue) end @@ -137,7 +136,6 @@ collapsed_sidebar_selector = 'aside.right-sidebar.right-sidebar-collapsed' expanded_sidebar_selector = 'aside.right-sidebar.right-sidebar-expanded' confidentiality_sidebar_block = '.block.confidentiality' - lock_sidebar_block = '.block.lock' collapsed_sidebar_block_icon = '.sidebar-collapsed-icon' before do @@ -159,28 +157,11 @@ expect(page).to have_css(collapsed_sidebar_selector) end - - it 'lock block expands then collapses sidebar' do - expect(page).to have_css(collapsed_sidebar_selector) - - page.within(lock_sidebar_block) do - find(collapsed_sidebar_block_icon).click - end - - expect(page).to have_css(expanded_sidebar_selector) - - page.within(lock_sidebar_block) do - page.find('button', text: 'Cancel').click - end - - expect(page).to have_css(collapsed_sidebar_selector) - end end end context 'as a guest' do before do - stub_feature_flags(moved_mr_sidebar: false) project.add_guest(user) visit_issue(project, issue) end @@ -188,37 +169,6 @@ it 'does not have a option to edit labels' do expect(page).not_to have_selector('.block.labels .js-sidebar-dropdown-toggle') end - - context 'for sidebar', :js do - it 'finds issue copy forwarding email' do - expect( - find('[data-testid="copy-forward-email"]').text - ).to eq "Issue email: #{issue.creatable_note_email_address(user)}" - end - end - - context 'when interacting with collapsed sidebar', :js do - collapsed_sidebar_selector = 'aside.right-sidebar.right-sidebar-collapsed' - expanded_sidebar_selector = 'aside.right-sidebar.right-sidebar-expanded' - lock_sidebar_block = '.block.lock' - lock_button = '.block.lock .btn-close' - collapsed_sidebar_block_icon = '.sidebar-collapsed-icon' - - before do - resize_screen_sm - end - - it 'expands then does not show the lock dialog form' do - expect(page).to have_css(collapsed_sidebar_selector) - - page.within(lock_sidebar_block) do - find(collapsed_sidebar_block_icon).click - end - - expect(page).to have_css(expanded_sidebar_selector) - expect(page).not_to have_selector(lock_button) - end - end end end diff --git a/spec/features/issues/user_toggles_subscription_spec.rb b/spec/features/issues/user_toggles_subscription_spec.rb index 713a169f061ee3..a1ea40c511f7c0 100644 --- a/spec/features/issues/user_toggles_subscription_spec.rb +++ b/spec/features/issues/user_toggles_subscription_spec.rb @@ -10,19 +10,19 @@ context 'user is not logged in' do before do - stub_feature_flags(moved_mr_sidebar: false) stub_feature_flags(notifications_todos_buttons: false) visit(project_issue_path(project, issue)) end it 'does not display the Notification toggle' do - expect(page).not_to have_button('Notifications') + find('.detail-page-header-actions .gl-new-dropdown-toggle').click + + expect(page).not_to have_selector('.is-checked:not(.is-checked)') end end context 'user is logged in' do before do - stub_feature_flags(moved_mr_sidebar: false) stub_feature_flags(notifications_todos_buttons: false) project.add_developer(user) sign_in(user) @@ -30,7 +30,9 @@ end it 'unsubscribes from issue' do - subscription_button = find('[data-testid="subscription-toggle"]') + find('.detail-page-header-actions .gl-new-dropdown-toggle').click + + subscription_button = find('[data-testid="notification-toggle"] [data-testid="toggle-wrapper"]') # Check we're subscribed. expect(subscription_button).to have_css("button.is-checked") @@ -42,20 +44,10 @@ # Check we're unsubscribed. expect(subscription_button).to have_css("button:not(.is-checked)") end - - context 'when project emails are disabled' do - let_it_be(:project) { create(:project_empty_repo, :public, emails_enabled: false) } - - it 'is disabled' do - expect(page).to have_content('Disabled by project owner') - expect(page).to have_selector('[data-testid="subscription-toggle"]', class: 'is-disabled') - end - end end context 'user is logged in without edit permission' do before do - stub_feature_flags(moved_mr_sidebar: false) stub_feature_flags(notifications_todos_buttons: false) sign_in(user2) @@ -63,7 +55,9 @@ end it 'subscribes to issue' do - subscription_button = find('[data-testid="subscription-toggle"]') + find('.detail-page-header-actions .gl-new-dropdown-toggle').click + + subscription_button = find('[data-testid="notification-toggle"] [data-testid="toggle-wrapper"]') # Check we're not subscribed. expect(subscription_button).to have_css("button:not(.is-checked)") @@ -79,7 +73,6 @@ context 'with notifications_todos_buttons feature flag enabled' do before do - stub_feature_flags(moved_mr_sidebar: true) stub_feature_flags(notifications_todos_buttons: true) sign_in(user2) diff --git a/spec/features/merge_request/batch_comments_spec.rb b/spec/features/merge_request/batch_comments_spec.rb index 6e98812753a658..3c0245bdf5bdac 100644 --- a/spec/features/merge_request/batch_comments_spec.rb +++ b/spec/features/merge_request/batch_comments_spec.rb @@ -13,8 +13,6 @@ end before do - stub_feature_flags(moved_mr_sidebar: false) - project.add_maintainer(user) sign_in(user) @@ -180,7 +178,7 @@ write_reply_to_discussion(button_text: 'Add comment now', resolve: true) - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -197,7 +195,7 @@ wait_for_requests - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -220,7 +218,7 @@ write_reply_to_discussion(button_text: 'Add comment now', unresolve: true) - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -240,7 +238,7 @@ wait_for_requests - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end diff --git a/spec/features/merge_request/close_reopen_report_toggle_spec.rb b/spec/features/merge_request/close_reopen_report_toggle_spec.rb index 07d9ddde91066e..d84801f1f2833f 100644 --- a/spec/features/merge_request/close_reopen_report_toggle_spec.rb +++ b/spec/features/merge_request/close_reopen_report_toggle_spec.rb @@ -15,7 +15,6 @@ before do project.add_maintainer(user) login_as user - stub_feature_flags(moved_mr_sidebar: false) end context 'when user has permission to update', :js do diff --git a/spec/features/merge_request/merge_request_discussion_lock_spec.rb b/spec/features/merge_request/merge_request_discussion_lock_spec.rb index 7e01063816f435..f4f90f7cd68032 100644 --- a/spec/features/merge_request/merge_request_discussion_lock_spec.rb +++ b/spec/features/merge_request/merge_request_discussion_lock_spec.rb @@ -8,105 +8,33 @@ let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:merge_request) { create(:merge_request, source_project: project, author: user) } - let(:moved_mr_sidebar_enabled) { false } before do - stub_feature_flags(moved_mr_sidebar: moved_mr_sidebar_enabled) sign_in(user) end - context 'moved sidebar flag disabled' do - context 'when a user is a team member' do - before do - project.add_developer(user) - end - - context 'when the discussion is unlocked' do - it 'the user can lock the merge_request' do - visit project_merge_request_path(merge_request.project, merge_request) - - expect(find('.issuable-sidebar')).to have_content('Unlocked') - - page.within('.issuable-sidebar') do - find('.lock-edit').click - click_button('Lock') - end - - expect(find('[data-testid="lock-status"]')).to have_content('Locked') - end - end - - context 'when the discussion is locked' do - before do - merge_request.update_attribute(:discussion_locked, true) - visit project_merge_request_path(merge_request.project, merge_request) - end - - it 'the user can unlock the merge_request' do - expect(find('.issuable-sidebar')).to have_content('Locked') - - page.within('.issuable-sidebar') do - find('.lock-edit').click - click_button('Unlock') - end - - expect(find('[data-testid="lock-status"]')).to have_content('Unlocked') - end - end + context 'when the discussion is unlocked' do + before do + visit project_merge_request_path(merge_request.project, merge_request) end - context 'when a user is not a team member' do - context 'when the discussion is unlocked' do - before do - visit project_merge_request_path(merge_request.project, merge_request) - end - - it 'the user can not lock the merge_request' do - expect(find('.issuable-sidebar')).to have_content('Unlocked') - expect(find('.issuable-sidebar')).not_to have_selector('.lock-edit') - end - end + it 'the user can lock the merge_request' do + find('#new-actions-header-dropdown button').click - context 'when the discussion is locked' do - before do - merge_request.update_attribute(:discussion_locked, true) - visit project_merge_request_path(merge_request.project, merge_request) - end - - it 'the user can not unlock the merge_request' do - expect(find('.issuable-sidebar')).to have_content('Locked') - expect(find('.issuable-sidebar')).not_to have_selector('.lock-edit') - end - end + expect(page).to have_content('Lock discussion') end end - context 'moved sidebar flag enabled' do - let(:moved_mr_sidebar_enabled) { true } - - context 'when the discussion is unlocked' do - before do - visit project_merge_request_path(merge_request.project, merge_request) - end - - it 'the user can lock the merge_request' do - find('#new-actions-header-dropdown button').click - - expect(page).to have_content('Lock discussion') - end + context 'when the discussion is locked' do + before do + merge_request.update_attribute(:discussion_locked, true) + visit project_merge_request_path(merge_request.project, merge_request) end - context 'when the discussion is locked' do - before do - merge_request.update_attribute(:discussion_locked, true) - visit project_merge_request_path(merge_request.project, merge_request) - end - - it 'the user can unlock the merge_request' do - find('#new-actions-header-dropdown button').click + it 'the user can unlock the merge_request' do + find('#new-actions-header-dropdown button').click - expect(page).to have_content('Unlock discussion') - end + expect(page).to have_content('Unlock discussion') end end end diff --git a/spec/features/merge_request/user_manages_subscription_spec.rb b/spec/features/merge_request/user_manages_subscription_spec.rb index 0853e3cb773f13..a7c82f1a6abb07 100644 --- a/spec/features/merge_request/user_manages_subscription_spec.rb +++ b/spec/features/merge_request/user_manages_subscription_spec.rb @@ -6,11 +6,9 @@ let(:project) { create(:project, :public, :repository) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:user) { create(:user) } - let(:moved_mr_sidebar_enabled) { false } let(:notifications_todos_buttons_enabled) { false } before do - stub_feature_flags(moved_mr_sidebar: moved_mr_sidebar_enabled) stub_feature_flags(notifications_todos_buttons: notifications_todos_buttons_enabled) project.add_maintainer(user) sign_in(user) @@ -18,50 +16,25 @@ visit(merge_request_path(merge_request)) end - context 'moved sidebar flag disabled' do - it 'toggles subscription' do - page.within('[data-testid="subscription-toggle"]') do - wait_for_requests - - expect(page).to have_css 'button:not(.is-checked)' - find('button:not(.is-checked)').click - - wait_for_requests - - expect(page).to have_css 'button.is-checked' - find('button.is-checked').click + it 'toggles subscription' do + wait_for_requests - wait_for_requests + find('#new-actions-header-dropdown button').click - expect(page).to have_css 'button:not(.is-checked)' - end - end - end + expect(page).to have_selector('.gl-toggle:not(.is-checked)') + find('[data-testid="notification-toggle"] .gl-toggle').click - context 'moved sidebar flag enabled' do - let(:moved_mr_sidebar_enabled) { true } + wait_for_requests - it 'toggles subscription' do - wait_for_requests + expect(page).to have_selector('.gl-toggle.is-checked') + find('[data-testid="notification-toggle"] .gl-toggle').click - find('#new-actions-header-dropdown button').click + wait_for_requests - expect(page).to have_selector('.gl-toggle:not(.is-checked)') - find('[data-testid="notification-toggle"] .gl-toggle').click - - wait_for_requests - - expect(page).to have_selector('.gl-toggle.is-checked') - find('[data-testid="notification-toggle"] .gl-toggle').click - - wait_for_requests - - expect(page).to have_selector('.gl-toggle:not(.is-checked)') - end + expect(page).to have_selector('.gl-toggle:not(.is-checked)') end context 'with notifications_todos_buttons feature flag enabled' do - let(:moved_mr_sidebar_enabled) { true } let(:notifications_todos_buttons_enabled) { true } it 'toggles subscription' do diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index 4bdef20304a7e1..1fb0efd08da8c0 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -13,10 +13,6 @@ build(:text_diff_position, file: path, old_line: nil, new_line: 9, diff_refs: merge_request.diff_refs) end - before do - stub_feature_flags(moved_mr_sidebar: false) - end - context 'no threads' do before do project.add_maintainer(user) @@ -40,7 +36,7 @@ context 'single thread' do it 'shows text with how many threads' do - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -57,7 +53,7 @@ expect(page).to have_selector('.btn', text: 'Unresolve thread') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -73,7 +69,7 @@ expect(page).to have_selector('.line-resolve-btn.is-active') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -84,7 +80,7 @@ click_button 'Unresolve thread' end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -155,7 +151,7 @@ wait_for_requests end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -167,7 +163,7 @@ wait_for_requests end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -183,7 +179,7 @@ wait_for_requests end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -195,7 +191,7 @@ find('button[data-testid="resolve-discussion-button"]').click end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -211,13 +207,13 @@ click_button 'Add comment now' end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end it 'allows user to quickly scroll to next unresolved thread', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/410109' do - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do page.find('.discussion-next-btn').click end @@ -266,7 +262,7 @@ expect(first('.line-resolve-btn')['aria-label']).to eq("Resolved by #{user.name}") end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -283,7 +279,7 @@ expect(button['aria-label']).to eq("Resolved by #{user.name}") end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -296,7 +292,7 @@ end it 'shows text with how many threads' do - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('2 unresolved threads') end end @@ -304,7 +300,7 @@ it 'allows user to mark a single note as resolved' do click_button('Resolve thread', match: :first) - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -314,7 +310,7 @@ btn.click end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -326,7 +322,7 @@ end end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -336,7 +332,7 @@ find('button[data-testid="resolve-discussion-button"]').click end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do page.find('.discussion-next-btn').click end @@ -365,7 +361,7 @@ expect(page).not_to have_selector('.btn', text: 'Resolve thread') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do page.find('.discussion-next-btn').click end @@ -381,7 +377,7 @@ context 'changes tab' do it 'shows text with how many threads' do - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -397,7 +393,7 @@ expect(page).to have_selector('.btn', text: 'Unresolve thread') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -411,7 +407,7 @@ expect(page).to have_selector('.line-resolve-btn.is-active') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -422,7 +418,7 @@ click_button 'Unresolve thread' end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -438,7 +434,7 @@ click_button 'Add comment now' end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -457,7 +453,7 @@ click_button 'Add comment now' end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -480,7 +476,7 @@ expect(page).not_to have_selector('.line-resolve-btn') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end @@ -510,7 +506,7 @@ expect(page).to have_selector('.btn', text: 'Unresolve thread') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('All threads resolved') end end @@ -528,7 +524,7 @@ expect(page).not_to have_selector('.line-resolve-btn') end - page.within '.discussions-counter' do + page.within(first('.discussions-counter')) do expect(page).to have_content('1 unresolved thread') end end diff --git a/spec/features/merge_request/user_views_open_merge_request_spec.rb b/spec/features/merge_request/user_views_open_merge_request_spec.rb index bc93e6caccb219..f1b68cd2dc9d32 100644 --- a/spec/features/merge_request/user_views_open_merge_request_spec.rb +++ b/spec/features/merge_request/user_views_open_merge_request_spec.rb @@ -114,25 +114,6 @@ end end - context 'XSS source branch' do - let(:project) { create(:project, :public, :repository) } - let(:source_branch) { "'><iframe/srcdoc=''></iframe>" } - - before do - stub_feature_flags(moved_mr_sidebar: false) - - project.repository.create_branch(source_branch, "master") - - mr = create(:merge_request, source_project: project, target_project: project, source_branch: source_branch) - - visit(merge_request_path(mr)) - end - - it 'encodes branch name' do - expect(find("[data-testid='ref-name']")[:title]).to eq(source_branch) - end - end - context 'when user preferred language has changed', :use_clean_rails_memory_store_fragment_caching do let(:project) { create(:project, :public, :repository) } let(:user) { create(:user) } diff --git a/spec/frontend/issues/show/components/header_actions_spec.js b/spec/frontend/issues/show/components/header_actions_spec.js index 33fd9d39febcaf..9a4125df83131d 100644 --- a/spec/frontend/issues/show/components/header_actions_spec.js +++ b/spec/frontend/issues/show/components/header_actions_spec.js @@ -133,8 +133,6 @@ describe('HeaderActions component', () => { findDesktopDropdown().findAllComponents(GlDisclosureDropdownItem); const findAbuseCategorySelector = () => wrapper.findComponent(AbuseCategorySelector); const findReportAbuseButton = () => wrapper.findByTestId('report-abuse-item'); - const findNotificationWidget = () => wrapper.findByTestId('notification-toggle'); - const findLockIssueWidget = () => wrapper.findByTestId('lock-issue-toggle'); const findCopyRefenceDropdownItem = () => wrapper.findByTestId('copy-reference'); const findCopyEmailItem = () => wrapper.findByTestId('copy-email'); @@ -158,7 +156,6 @@ describe('HeaderActions component', () => { props = {}, issueState = STATUS_OPEN, blockedByIssues = [], - movedMrSidebarEnabled = false, promoteToEpicHandler = promoteToEpicMutationSuccessResponseHandler, } = {}) => { store.dispatch('setNoteableData', { @@ -182,9 +179,6 @@ describe('HeaderActions component', () => { provide: { ...defaultProps, ...props, - glFeatures: { - movedMrSidebar: movedMrSidebarEnabled, - }, }, stubs: { GlButton, @@ -346,7 +340,7 @@ describe('HeaderActions component', () => { }); it('tracks clicking on button', () => { - findDesktopDropdownItems().at(4).vm.$emit('action'); + findDesktopDropdownItems().at(5).vm.$emit('action'); expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_dropdown', { label: 'delete_issue', @@ -527,96 +521,13 @@ describe('HeaderActions component', () => { }); }); - describe('notification toggle', () => { - describe('visibility', () => { - describe.each` - movedMrSidebarEnabled | issueType | visible - ${true} | ${TYPE_ISSUE} | ${true} - ${true} | ${TYPE_INCIDENT} | ${true} - ${false} | ${TYPE_ISSUE} | ${false} - ${false} | ${TYPE_INCIDENT} | ${false} - `( - `when movedMrSidebarEnabled flag is "$movedMrSidebarEnabled" with issue type "$issueType"`, - ({ movedMrSidebarEnabled, issueType, visible }) => { - beforeEach(() => { - wrapper = mountComponent({ - props: { - issueType, - }, - movedMrSidebarEnabled, - }); - }); - - it(`${visible ? 'shows' : 'hides'} Notification toggle`, () => { - expect(findNotificationWidget().exists()).toBe(visible); - }); - }, - ); - }); - }); - - describe('lock issue option', () => { - describe('visibility', () => { - describe.each` - movedMrSidebarEnabled | issueType | visible - ${true} | ${TYPE_ISSUE} | ${true} - ${true} | ${TYPE_INCIDENT} | ${false} - ${false} | ${TYPE_ISSUE} | ${false} - ${false} | ${TYPE_INCIDENT} | ${false} - `( - `when movedMrSidebarEnabled flag is "$movedMrSidebarEnabled" with issue type "$issueType"`, - ({ movedMrSidebarEnabled, issueType, visible }) => { - beforeEach(() => { - wrapper = mountComponent({ - props: { - issueType, - }, - movedMrSidebarEnabled, - }); - }); - - it(`${visible ? 'shows' : 'hides'} Lock issue option`, () => { - expect(findLockIssueWidget().exists()).toBe(visible); - }); - }, - ); - }); - }); - describe('copy reference option', () => { - describe('visibility', () => { - describe.each` - movedMrSidebarEnabled | issueType | visible - ${true} | ${TYPE_ISSUE} | ${true} - ${true} | ${TYPE_INCIDENT} | ${true} - ${false} | ${TYPE_ISSUE} | ${false} - ${false} | ${TYPE_INCIDENT} | ${false} - `( - 'when movedMrSidebarFlagEnabled is "$movedMrSidebarEnabled" with issue type "$issueType"', - ({ movedMrSidebarEnabled, issueType, visible }) => { - beforeEach(() => { - wrapper = mountComponent({ - props: { - issueType, - }, - movedMrSidebarEnabled, - }); - }); - - it(`${visible ? 'shows' : 'hides'} Copy reference option`, () => { - expect(findCopyRefenceDropdownItem().exists()).toBe(visible); - }); - }, - ); - }); - describe('clicking when visible', () => { beforeEach(() => { wrapper = mountComponent({ props: { issueType: TYPE_ISSUE, }, - movedMrSidebarEnabled: true, }); }); @@ -633,35 +544,6 @@ describe('HeaderActions component', () => { }); describe('copy email option', () => { - describe('visibility', () => { - describe.each` - movedMrSidebarEnabled | issueType | issuableEmailAddress | visible - ${true} | ${TYPE_ISSUE} | ${'mock-email-address'} | ${true} - ${true} | ${TYPE_ISSUE} | ${''} | ${false} - ${true} | ${TYPE_INCIDENT} | ${'mock-email-address'} | ${true} - ${true} | ${TYPE_INCIDENT} | ${''} | ${false} - ${false} | ${TYPE_ISSUE} | ${'mock-email-address'} | ${false} - ${false} | ${TYPE_INCIDENT} | ${'mock-email-address'} | ${false} - `( - 'when movedMrSidebarEnabled flag is "$movedMrSidebarEnabled" issue type is "$issueType" and issuableEmailAddress="$issuableEmailAddress"', - ({ movedMrSidebarEnabled, issueType, issuableEmailAddress, visible }) => { - beforeEach(() => { - wrapper = mountComponent({ - props: { - issueType, - issuableEmailAddress, - }, - movedMrSidebarEnabled, - }); - }); - - it(`${visible ? 'shows' : 'hides'} Copy email option`, () => { - expect(findCopyEmailItem().exists()).toBe(visible); - }); - }, - ); - }); - describe('clicking when visible', () => { beforeEach(() => { wrapper = mountComponent({ @@ -669,7 +551,6 @@ describe('HeaderActions component', () => { issueType: TYPE_ISSUE, issuableEmailAddress: 'mock-email-address', }, - movedMrSidebarEnabled: true, }); }); @@ -681,42 +562,6 @@ describe('HeaderActions component', () => { }); }); - describe('when logged out', () => { - describe.each` - movedMrSidebarEnabled | issueType | headerActionsVisible - ${true} | ${TYPE_ISSUE} | ${true} - ${true} | ${TYPE_INCIDENT} | ${true} - ${false} | ${TYPE_ISSUE} | ${false} - ${false} | ${TYPE_INCIDENT} | ${false} - `( - `with movedMrSidebarEnabled flag is "$movedMrSidebarEnabled" with issue type "$issueType"`, - ({ movedMrSidebarEnabled, issueType, headerActionsVisible }) => { - beforeEach(async () => { - wrapper = mountComponent({ - props: { - issueType, - canCreateIssue: false, - canPromoteToEpic: false, - canReportSpam: false, - }, - movedMrSidebarEnabled, - isLoggedIn: false, - }); - - await waitForPromises(); - }); - - it(`${headerActionsVisible ? 'shows' : 'hides'} headers actions`, () => { - expect(findDesktopDropdown().exists()).toBe(headerActionsVisible); - expect(findCopyRefenceDropdownItem().exists()).toBe(headerActionsVisible); - expect(findNotificationWidget().exists()).toBe(false); - expect(findReportAbuseButton().exists()).toBe(false); - expect(findLockIssueWidget().exists()).toBe(false); - }); - }, - ); - }); - describe('issue type text', () => { it.each` issueType | expectedText @@ -728,7 +573,6 @@ describe('HeaderActions component', () => { ${'unknown'} | ${'unknown'} `('$issueType', ({ issueType, expectedText }) => { wrapper = mountComponent({ - movedMrSidebarEnabled: true, props: { issueType, issuableEmailAddress: 'mock-email-address' }, }); diff --git a/spec/frontend/merge_request_tabs_spec.js b/spec/frontend/merge_request_tabs_spec.js index 6c4ea7063ad41b..3a9751bc217788 100644 --- a/spec/frontend/merge_request_tabs_spec.js +++ b/spec/frontend/merge_request_tabs_spec.js @@ -357,8 +357,6 @@ describe('MergeRequestTabs', () => { ${'diffs'} | ${true} | ${'hides'} ${'commits'} | ${true} | ${'hides'} `('$hidesText expand button on $tab tab', ({ tab, hides }) => { - window.gon = { features: { movedMrSidebar: true } }; - const expandButton = document.createElement('div'); expandButton.classList.add('js-expand-sidebar'); diff --git a/spec/frontend/sidebar/components/lock/issuable_lock_form_spec.js b/spec/frontend/sidebar/components/lock/issuable_lock_form_spec.js index 69531af6e3a8a9..33d15d7eb34254 100644 --- a/spec/frontend/sidebar/components/lock/issuable_lock_form_spec.js +++ b/spec/frontend/sidebar/components/lock/issuable_lock_form_spec.js @@ -1,16 +1,13 @@ -import { GlIcon } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import Vue, { nextTick } from 'vue'; +import Vue from 'vue'; // eslint-disable-next-line no-restricted-imports import Vuex from 'vuex'; -import { mockTracking, triggerEvent } from 'helpers/tracking_helper'; -import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; +import { createMockDirective } from 'helpers/vue_mock_directive'; import createStore from '~/notes/stores'; -import EditForm from '~/sidebar/components/lock/edit_form.vue'; import IssuableLockForm from '~/sidebar/components/lock/issuable_lock_form.vue'; import toast from '~/vue_shared/plugins/global_toast'; import waitForPromises from 'helpers/wait_for_promises'; -import { ISSUABLE_TYPE_ISSUE, ISSUABLE_TYPE_MR } from './constants'; +import { ISSUABLE_TYPE_ISSUE } from './constants'; jest.mock('~/vue_shared/plugins/global_toast'); @@ -25,15 +22,7 @@ describe('IssuableLockForm', () => { const setIssuableType = (pageType) => { issuableType = pageType; }; - - const findSidebarCollapseIcon = () => wrapper.find('[data-testid="sidebar-collapse-icon"]'); - const findLockStatus = () => wrapper.find('[data-testid="lock-status"]'); - const findEditLink = () => wrapper.find('[data-testid="edit-link"]'); - const findEditForm = () => wrapper.findComponent(EditForm); const findLockButton = () => wrapper.find('[data-testid="issuable-lock"]'); - const findSidebarLockStatusTooltip = () => - getBinding(findSidebarCollapseIcon().element, 'gl-tooltip'); - const findIssuableLockClickable = () => wrapper.find('[data-testid="issuable-lock"]'); const initStore = (isLocked) => { if (issuableType === ISSUABLE_TYPE_ISSUE) { @@ -53,14 +42,11 @@ describe('IssuableLockForm', () => { store.getters.getNoteableData.discussion_locked = isLocked; }; - const createComponent = ({ props = {}, movedMrSidebar = false }) => { + const createComponent = ({ props = {} } = {}) => { wrapper = shallowMount(IssuableLockForm, { store, provide: { fullPath: '', - glFeatures: { - movedMrSidebar, - }, }, propsData: { isEditable: true, @@ -72,103 +58,6 @@ describe('IssuableLockForm', () => { }); }; - describe.each` - pageType - ${ISSUABLE_TYPE_ISSUE} | ${ISSUABLE_TYPE_MR} - `('In $pageType page', ({ pageType }) => { - beforeEach(() => { - setIssuableType(pageType); - }); - - describe.each` - isLocked - ${false} | ${true} - `(`renders for isLocked = $isLocked`, ({ isLocked }) => { - beforeEach(() => { - initStore(isLocked); - createComponent({}); - }); - - it('shows the lock status', () => { - expect(findLockStatus().text()).toBe(isLocked ? 'Locked' : 'Unlocked'); - }); - - describe('edit form', () => { - let isEditable; - beforeEach(() => { - isEditable = false; - createComponent({ props: { isEditable } }); - }); - - describe('when not editable', () => { - it('does not display the edit form when opened if not editable', async () => { - expect(findEditForm().exists()).toBe(false); - findSidebarCollapseIcon().trigger('click'); - - await nextTick(); - expect(findEditForm().exists()).toBe(false); - }); - }); - - describe('when editable', () => { - beforeEach(() => { - isEditable = true; - createComponent({ props: { isEditable } }); - }); - - it('shows the editable status', () => { - expect(findEditLink().exists()).toBe(isEditable); - expect(findEditLink().text()).toBe('Edit'); - }); - - describe("when 'Edit' is clicked", () => { - it('displays the edit form when editable', async () => { - expect(findEditForm().exists()).toBe(false); - findEditLink().trigger('click'); - - await nextTick(); - expect(findEditForm().exists()).toBe(true); - }); - - it('tracks the event', () => { - const spy = mockTracking('_category_', wrapper.element, jest.spyOn); - triggerEvent(findEditLink().element); - - expect(spy).toHaveBeenCalledWith('_category_', 'click_edit_button', { - label: 'right_sidebar', - property: 'lock_issue', - }); - }); - }); - - describe('When sidebar is collapsed', () => { - it('displays the edit form when opened', async () => { - expect(findEditForm().exists()).toBe(false); - findSidebarCollapseIcon().trigger('click'); - - await nextTick(); - expect(findEditForm().exists()).toBe(true); - }); - - it('renders a tooltip with the lock status text', () => { - const tooltip = findSidebarLockStatusTooltip(); - - expect(tooltip).toBeDefined(); - expect(tooltip.value.title).toBe(isLocked ? 'Locked' : 'Unlocked'); - }); - - it('renders lock icon', () => { - const icon = findSidebarCollapseIcon().findComponent(GlIcon).props('name'); - const expected = isLocked ? 'lock' : 'lock-open'; - - expect(icon).toBe(expected); - }); - }); - }); - }); - }); - }); - describe('merge requests', () => { beforeEach(() => { setIssuableType('merge_request'); @@ -181,7 +70,7 @@ describe('IssuableLockForm', () => { `('displays $message when merge request is $locked', async ({ locked, message }) => { initStore(locked); - createComponent({ movedMrSidebar: true }); + createComponent(); await findLockButton().trigger('click'); @@ -190,20 +79,4 @@ describe('IssuableLockForm', () => { expect(toast).toHaveBeenCalledWith(message); }); }); - - describe('moved_mr_sidebar flag', () => { - describe('when the flag is off', () => { - it('does not show the non editable lock status', () => { - createComponent({ movedMrSidebar: false }); - expect(findIssuableLockClickable().exists()).toBe(false); - }); - }); - - describe('when the flag is on', () => { - it('shows the non editable lock status', () => { - createComponent({ movedMrSidebar: true }); - expect(findIssuableLockClickable().exists()).toBe(true); - }); - }); - }); }); diff --git a/spec/frontend/sidebar/components/subscriptions/sidebar_subscriptions_widget_spec.js b/spec/frontend/sidebar/components/subscriptions/sidebar_subscriptions_widget_spec.js index 39b80c1d886390..2f752f08debea5 100644 --- a/spec/frontend/sidebar/components/subscriptions/sidebar_subscriptions_widget_spec.js +++ b/spec/frontend/sidebar/components/subscriptions/sidebar_subscriptions_widget_spec.js @@ -1,11 +1,10 @@ -import { GlDisclosureDropdownItem, GlIcon, GlToggle } from '@gitlab/ui'; +import { GlDisclosureDropdownItem, GlToggle } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { createAlert } from '~/alert'; -import SidebarEditableItem from '~/sidebar/components/sidebar_editable_item.vue'; import SidebarSubscriptionWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import issueSubscribedQuery from '~/sidebar/queries/issue_subscribed.query.graphql'; import updateMergeRequestSubscriptionMutation from '~/sidebar/queries/update_merge_request_subscription.mutation.graphql'; @@ -25,15 +24,12 @@ describe('Sidebar Subscriptions Widget', () => { let fakeApollo; let subscriptionMutationHandler; - const findEditableItem = () => wrapper.findComponent(SidebarEditableItem); const findToggle = () => wrapper.findComponent(GlToggle); - const findIcon = () => wrapper.findComponent(GlIcon); const findDropdownToggleItem = () => wrapper.findComponent(GlDisclosureDropdownItem); const createComponent = ({ subscriptionsQueryHandler = jest.fn().mockResolvedValue(issueSubscriptionsResponse()), issuableType = 'issue', - movedMrSidebar = false, } = {}) => { subscriptionMutationHandler = jest .fn() @@ -47,18 +43,12 @@ describe('Sidebar Subscriptions Widget', () => { apolloProvider: fakeApollo, provide: { canUpdate: true, - glFeatures: { - movedMrSidebar, - }, }, propsData: { fullPath: 'group/project', iid: '1', issuableType, }, - stubs: { - SidebarEditableItem, - }, }); }; @@ -66,22 +56,11 @@ describe('Sidebar Subscriptions Widget', () => { fakeApollo = null; }); - it('passes a `loading` prop as true to editable item when query is loading', () => { - createComponent(); - - expect(findEditableItem().props('loading')).toBe(true); - }); - describe('when user is not subscribed to the issue', () => { beforeEach(() => { createComponent(); return waitForPromises(); }); - - it('passes a `loading` prop as false to editable item', () => { - expect(findEditableItem().props('loading')).toBe(false); - }); - it('toggle is unchecked', () => { expect(findToggle().props('value')).toBe(false); }); @@ -99,10 +78,6 @@ describe('Sidebar Subscriptions Widget', () => { return waitForPromises(); }); - it('passes a `loading` prop as false to editable item', () => { - expect(findEditableItem().props('loading')).toBe(false); - }); - it('toggle is checked', () => { expect(findToggle().props('value')).toBe(true); }); @@ -112,32 +87,6 @@ describe('Sidebar Subscriptions Widget', () => { }); }); - describe('when emails are disabled', () => { - it('toggle is disabled and off when user is subscribed', async () => { - createComponent({ - subscriptionsQueryHandler: jest - .fn() - .mockResolvedValue(issueSubscriptionsResponse(true, true)), - }); - await waitForPromises(); - - expect(findIcon().props('name')).toBe('notifications-off'); - expect(findToggle().props('disabled')).toBe(true); - }); - - it('toggle is disabled and off when user is not subscribed', async () => { - createComponent({ - subscriptionsQueryHandler: jest - .fn() - .mockResolvedValue(issueSubscriptionsResponse(false, true)), - }); - await waitForPromises(); - - expect(findIcon().props('name')).toBe('notifications-off'); - expect(findToggle().props('disabled')).toBe(true); - }); - }); - it('displays an alert message when query is rejected', async () => { createComponent({ subscriptionsQueryHandler: jest.fn().mockRejectedValue('Houston, we have a problem'), @@ -151,7 +100,6 @@ describe('Sidebar Subscriptions Widget', () => { it('displays toast when mutation is successful', async () => { createComponent({ issuableType: 'merge_request', - movedMrSidebar: true, subscriptionsQueryHandler: jest.fn().mockResolvedValue(issueSubscriptionsResponse(true)), }); await waitForPromises(); diff --git a/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js b/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js index b2477e9b41c7b8..d9c77eb94d1110 100644 --- a/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js +++ b/spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js @@ -132,10 +132,10 @@ describe('Sidebar Todo Widget', () => { expect(findTodoButton().attributes('loading')).toBe('true'); }); - it('is not in the loading state if notificationsTodosButtons and movedMrSidebar feature flags are enabled', () => { + it('is not in the loading state if notificationsTodosButtons feature flag is enabled', () => { createComponent({ provide: { - glFeatures: { notificationsTodosButtons: true, movedMrSidebar: true }, + glFeatures: { notificationsTodosButtons: true }, }, }); diff --git a/spec/frontend/vue_shared/components/mr_more_dropdown_spec.js b/spec/frontend/vue_shared/components/mr_more_dropdown_spec.js index 41639725f66cb6..b3274f86b9ff8a 100644 --- a/spec/frontend/vue_shared/components/mr_more_dropdown_spec.js +++ b/spec/frontend/vue_shared/components/mr_more_dropdown_spec.js @@ -13,7 +13,6 @@ describe('MR More actions sidebar', () => { const findReportAbuseOption = () => wrapper.find('[data-testid="report-abuse-option"]'); const createComponent = ({ - movedMrSidebarFlag = false, isCurrentUser = true, isLoggedIn = true, open = false, @@ -29,30 +28,21 @@ describe('MR More actions sidebar', () => { open, canUpdateMergeRequest, }, - provide: { - glFeatures: { movedMrSidebar: movedMrSidebarFlag }, - }, }); }; describe('Notifications toggle', () => { it.each` - movedMrSidebarFlag | isLoggedIn | showNotificationToggle - ${false} | ${false} | ${false} - ${false} | ${true} | ${false} - ${true} | ${false} | ${false} - ${true} | ${true} | ${true} - `( - "when the movedMrSidebar flag is '$movedMrSidebarFlag' and is isLoggedIn as '$isLoggedIn'", - ({ movedMrSidebarFlag, isLoggedIn, showNotificationToggle }) => { - createComponent({ - isLoggedIn, - movedMrSidebarFlag, - }); - - expect(findNotificationToggle().exists()).toBe(showNotificationToggle); - }, - ); + isLoggedIn | showNotificationToggle + ${false} | ${false} + ${true} | ${true} + `("when is isLoggedIn as '$isLoggedIn'", ({ isLoggedIn, showNotificationToggle }) => { + createComponent({ + isLoggedIn, + }); + + expect(findNotificationToggle().exists()).toBe(showNotificationToggle); + }); }); describe('Edit/Draft/Reopen MR', () => { @@ -108,15 +98,9 @@ describe('MR More actions sidebar', () => { }); describe('Copy reference', () => { - it('should not be visible by default', () => { + it('should be visible', () => { createComponent(); - expect(findCopyReferenceButton().exists()).toBe(false); - }); - - it('should be visible when the movedMrSidebarFlag is on', () => { - createComponent({ movedMrSidebarFlag: true }); - expect(findCopyReferenceButton().exists()).toBe(true); }); }); diff --git a/spec/support/shared_examples/features/sidebar_shared_examples.rb b/spec/support/shared_examples/features/sidebar_shared_examples.rb index f402a1bc91a46c..69f11561792221 100644 --- a/spec/support/shared_examples/features/sidebar_shared_examples.rb +++ b/spec/support/shared_examples/features/sidebar_shared_examples.rb @@ -97,21 +97,6 @@ expect(subscription_button).to have_css("button:not(.is-checked)") end - - context 'when notifications have been disabled' do - before do - project.update_attribute(:emails_enabled, false) - - refresh_and_click_first_card - end - - it 'displays a message that notifications have been disabled' do - page.within('[data-testid="sidebar-notifications"]') do - expect(page).to have_selector('[data-testid="subscription-toggle"]', class: 'is-disabled') - expect(page).to have_content('Disabled by project owner') - end - end - end end context 'confidentiality' do -- GitLab