diff --git a/app/assets/javascripts/constants.js b/app/assets/javascripts/constants.js index 631968ff531d646e9e9cb0a5007468ec7c49f135..f43a2d5d8ff5b1de0a999949cd97359a20d036bc 100644 --- a/app/assets/javascripts/constants.js +++ b/app/assets/javascripts/constants.js @@ -3,5 +3,3 @@ export const getModifierKey = (removeSuffix = false) => { const winKey = `Ctrl${removeSuffix ? '' : '+'}`; return window.gl?.client?.isMac ? '⌘' : winKey; }; - -export const PRELOAD_THROTTLE_TIMEOUT_MS = 4000; diff --git a/app/assets/javascripts/gl_form.js b/app/assets/javascripts/gl_form.js index ed2d1dbb7d205d1463839b54f9f5a098cdd9db23..f4008fe3cc927edfd9623ed1fde393b58f66fec6 100644 --- a/app/assets/javascripts/gl_form.js +++ b/app/assets/javascripts/gl_form.js @@ -5,7 +5,6 @@ import GfmAutoComplete, { defaultAutocompleteConfig } from 'ee_else_ce/gfm_auto_ import { disableButtonIfEmptyField } from '~/lib/utils/common_utils'; import dropzoneInput from './dropzone_input'; import { addMarkdownListeners, removeMarkdownListeners } from './lib/utils/text_markdown'; -import { PRELOAD_THROTTLE_TIMEOUT_MS } from './constants'; export default class GLForm { /** @@ -18,11 +17,10 @@ export default class GLForm { * By default, the backend embeds these in the global object gl.GfmAutocomplete.dataSources. * Use this param to override them. */ - constructor(form, enableGFM = {}, forceNew = false, gfmDataSources = {}, preloadMembers = false) { + constructor(form, enableGFM = {}, forceNew = false, gfmDataSources = {}) { this.form = form; this.textarea = this.form.find('textarea.js-gfm-input'); this.enableGFM = { ...defaultAutocompleteConfig, ...enableGFM }; - this.preloadMembers = preloadMembers; // Disable autocomplete for keywords which do not have dataSources available let dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {}; @@ -70,21 +68,6 @@ export default class GLForm { ); this.autoComplete = new GfmAutoComplete(dataSources); this.autoComplete.setup(this.form.find('.js-gfm-input'), this.enableGFM); - - if (this.preloadMembers && dataSources?.members) { - // for now the preload is only implemented for the members - // timeout helping to trottle the preloads in the case content_editor - // is set as main comment editor and support for rspec tests - // https://gitlab.com/gitlab-org/gitlab/-/issues/427437 - - requestIdleCallback(() => - setTimeout( - () => this.autoComplete?.fetchData($('.js-gfm-input'), '@'), - PRELOAD_THROTTLE_TIMEOUT_MS, - ), - ); - } - this.formDropzone = dropzoneInput(this.form, { parallelUploads: 1 }); if (this.form.is(':not(.js-no-autosize)')) { diff --git a/app/assets/javascripts/mr_notes/init_notes.js b/app/assets/javascripts/mr_notes/init_notes.js index c9e56a6161f491b90f7087112a223ca7719b32f7..265e2a2f8805fe47482b6bfb3ba2805be8c19fc3 100644 --- a/app/assets/javascripts/mr_notes/init_notes.js +++ b/app/assets/javascripts/mr_notes/init_notes.js @@ -12,7 +12,6 @@ import discussionNavigator from '../notes/components/discussion_navigator.vue'; import NotesApp from '../notes/components/notes_app.vue'; import { getNotesFilterData } from '../notes/utils/get_notes_filter_data'; import initWidget from '../vue_merge_request_widget'; -import { MERGE_REQUEST_NOTEABLE_TYPE } from '../notes/constants'; export default () => { requestIdleCallback( @@ -46,9 +45,6 @@ export default () => { newCommentTemplatePath: notesDataset.newCommentTemplatePath, mrFilter: true, newCustomEmojiPath: notesDataset.newCustomEmojiPath, - preloadMembers: - notesDataset?.noteableType === MERGE_REQUEST_NOTEABLE_TYPE && - gon?.features?.preloadAutocompleteMembersIssuesMrs, }, data() { const noteableData = JSON.parse(notesDataset.noteableData); diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js index cc9a3d879397cd2dc8cecd4223920f3049cd9dcb..f9fbe6659ee65e410a8e61dbdee0d53f30f27e4b 100644 --- a/app/assets/javascripts/notes/index.js +++ b/app/assets/javascripts/notes/index.js @@ -7,7 +7,6 @@ import { getLocationHash } from '~/lib/utils/url_utility'; import NotesApp from './components/notes_app.vue'; import { store } from './stores'; import { getNotesFilterData } from './utils/get_notes_filter_data'; -import { ISSUE_NOTEABLE_TYPE } from './constants'; export default ({ editorAiActions = [] } = {}) => { const el = document.getElementById('js-vue-notes'); @@ -64,9 +63,6 @@ export default ({ editorAiActions = [] } = {}) => { resourceGlobalId: convertToGraphQLId(noteableData.noteableType, noteableData.id), editorAiActions: editorAiActions.map((factory) => factory(noteableData)), newCustomEmojiPath: notesDataset.newCustomEmojiPath, - preloadMembers: - notesDataset.noteableType === ISSUE_NOTEABLE_TYPE && - gon?.features?.preloadAutocompleteMembersIssuesMrs, }, data() { return { diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index 034d591b6caea1cae90aa7850ef555191ef054ec..e80f5c7f0927ee61e6531432091b719647ed3bb8 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -33,13 +33,6 @@ export default { GlTooltip: GlTooltipDirective, }, mixins: [glFeatureFlagsMixin()], - inject: { - preloadMembers: { - type: Boolean, - required: false, - default: false, - }, - }, props: { /** * This prop should be bound to the value of the `<textarea>` element @@ -285,7 +278,6 @@ export default { }, true, this.autocompleteDataSources, - this.preloadMembers, ); markdownEditorEventHub.$emit(MARKDOWN_EDITOR_READY_EVENT); diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 81e3fb60d0c75b72722d15ee826cc3c4d9fcd864..7a2b00d5aa6ca1c895d502d20fd93363099b7381 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -71,7 +71,6 @@ class Projects::IssuesController < Projects::ApplicationController push_force_frontend_feature_flag(:linked_work_items, project.linked_work_items_feature_flag_enabled?) push_frontend_feature_flag(:notifications_todos_buttons, current_user) push_frontend_feature_flag(:mention_autocomplete_backend_filtering, project) - push_frontend_feature_flag(:preload_autocomplete_members_issues_mrs, current_user) end around_action :allow_gitaly_ref_name_caching, only: [:discussions] diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 6edf57ccc53711735a3e6d5263fbb4245ab2c64b..b4ce23de83ce1d6962535f6e2b9bae9305d6b245 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -48,7 +48,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo push_frontend_feature_flag(:mention_autocomplete_backend_filtering, project) push_frontend_feature_flag(:pinned_file, project) push_frontend_feature_flag(:merge_request_diff_generated_subscription, project) - push_frontend_feature_flag(:preload_autocomplete_members_issues_mrs, current_user) end around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :diffs, :discussions] diff --git a/config/feature_flags/development/preload_autocomplete_members_issues_mrs.yml b/config/feature_flags/development/preload_autocomplete_members_issues_mrs.yml deleted file mode 100644 index e1789dccaa1b25e61c45699646900b54323a0d07..0000000000000000000000000000000000000000 --- a/config/feature_flags/development/preload_autocomplete_members_issues_mrs.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: preload_autocomplete_members_issues_mrs -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139085 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/435698 -milestone: '16.8' -type: development -group: group::global search -default_enabled: false diff --git a/spec/features/issues/user_comments_on_issue_spec.rb b/spec/features/issues/user_comments_on_issue_spec.rb index b6e9754485ebebdecd9d18ea5318078c968b6dd1..d27f3ffebe6f13d162b964f2f17efbee3c902748 100644 --- a/spec/features/issues/user_comments_on_issue_spec.rb +++ b/spec/features/issues/user_comments_on_issue_spec.rb @@ -35,7 +35,7 @@ # do not test quick actions here since guest users don't have permission # to execute all quick actions - it_behaves_like 'edits content using the content editor', { with_quick_actions: false }, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/439368' + it_behaves_like 'edits content using the content editor', { with_quick_actions: false } it "adds comment with code block" do code_block_content = "Command [1]: /usr/local/bin/git , see [text](doc/text)" diff --git a/spec/features/merge_request/user_comments_on_merge_request_spec.rb b/spec/features/merge_request/user_comments_on_merge_request_spec.rb index d49662edd57eeca3d1c453fcbcb9bd0ee119e840..d02463efedd1be7ba412bf8ddd3c52b4922cc8a5 100644 --- a/spec/features/merge_request/user_comments_on_merge_request_spec.rb +++ b/spec/features/merge_request/user_comments_on_merge_request_spec.rb @@ -33,7 +33,7 @@ end end - context 'with content editor', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/439368' do + context 'with content editor' do it_behaves_like 'edits content using the content editor' end @@ -94,9 +94,7 @@ end wait_for_requests - page.within('.modal-dialog') do - expect(page).to have_content('Are you sure you want to cancel creating this comment?') - end + expect(page.html).to include('Are you sure you want to cancel creating this comment?') end it 'loads new comment' do diff --git a/spec/frontend/gl_form_spec.js b/spec/frontend/gl_form_spec.js index b99b43d303961fcd1739ea68a0fcf1781895f95f..6ad9d9f433881bc579c7e1d14bac6a651762a2c8 100644 --- a/spec/frontend/gl_form_spec.js +++ b/spec/frontend/gl_form_spec.js @@ -1,7 +1,6 @@ import autosize from 'autosize'; import $ from 'jquery'; import GLForm from '~/gl_form'; -import GfmAutoComplete from 'ee_else_ce/gfm_auto_complete'; import '~/lib/utils/text_utility'; import '~/lib/utils/common_utils'; @@ -47,43 +46,6 @@ describe('GLForm', () => { expect(setupFormSpy).toHaveBeenCalledWith(customDataSources, false); }); }); - - describe('GfmAutoComplete', () => { - let autocompleteDataFetchSpy; - const updatedMockGl = { ...mockGl }; - - updatedMockGl.GfmAutoComplete.dataSources = { - ...updatedMockGl.GfmAutoComplete.dataSources, - members: '/group/projects/-/autocomplete_sources/members', - }; - - beforeEach(() => { - jest.spyOn(window, 'requestIdleCallback').mockImplementation((cb) => cb()); - - // We need to mock implement fetchData to prevent - // the axios call which is not subject of this test - autocompleteDataFetchSpy = jest - .spyOn(GfmAutoComplete.prototype, 'fetchData') - .mockImplementation(() => 'test'); - - testContext.form = $('<form class="gfm-form"><textarea class="js-gfm-input"></form>'); - testContext.textarea = testContext.form.find('textarea'); - }); - - afterEach(() => { - window.requestIdleCallback.mockRestore(); - autocompleteDataFetchSpy.mockRestore(); - }); - - it('will call fetchdata if preloadMembers is enabled', () => { - window.gl = { ...updatedMockGl }; - - testContext.glForm = new GLForm(testContext.form, {}, true, {}, true); - jest.runAllTimers(); - expect(autocompleteDataFetchSpy).toHaveBeenCalledTimes(1); - expect(autocompleteDataFetchSpy).toHaveBeenCalledWith(expect.any(Object), '@'); - }); - }); }); describe('when instantiated', () => { diff --git a/spec/frontend/vue_shared/components/markdown/field_spec.js b/spec/frontend/vue_shared/components/markdown/field_spec.js index 9d8924c92f7f3e7425d7232a2f52708108154c4e..4ade8f28fd0e304ad7289893a8ebfd7e6d622774 100644 --- a/spec/frontend/vue_shared/components/markdown/field_spec.js +++ b/spec/frontend/vue_shared/components/markdown/field_spec.js @@ -67,9 +67,6 @@ describe('Markdown field component', () => { showContentEditorSwitcher, supportsQuickActions: true, }, - provide: { - preloadMembers: true, - }, mocks: { $apollo: { queries: { @@ -96,9 +93,6 @@ describe('Markdown field component', () => { showContentEditorSwitcher: false, autocompleteDataSources, }, - provide: { - preloadMembers: true, - }, }); } @@ -137,10 +131,6 @@ describe('Markdown field component', () => { commands: '/foobar/-/autocomplete_sources', }); }); - - it('initializes GlForm with autocomplete data sources and preload memebers', () => { - expect(findGlForm().preloadMembers).toBe(true); - }); }); it('renders textarea inside backdrop', () => { diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb index 12dc3cfcc6ea9b8bb0c86b6bf7a6a6c8c36a9d53..09444084eb9ac696b5f08ec062e07adb09f241ee 100644 --- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb @@ -152,7 +152,7 @@ it_behaves_like 'edits content using the content editor', { with_expanded_references: false, with_quick_actions: false - }, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/439368' + } it_behaves_like 'inserts diagrams.net diagram using the content editor' it_behaves_like 'autocompletes items' end