Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-07-04 15:10:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-07-04 15:10:11 +0300
commitcef4494e260d221524fc4e7e1d06d7554fdc7daa (patch)
tree711ecf05d532c728c8f255fb208c20d68d05113b /app
parent5f95234f7babb69685710dbfc637f29eeac2a917 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/content_editor/components/formatting_toolbar.vue41
-rw-r--r--app/assets/javascripts/content_editor/components/toolbar_table_button.vue83
-rw-r--r--app/assets/javascripts/pages/projects/blob/show/index.js2
-rw-r--r--app/assets/javascripts/repository/components/blob_content_viewer.vue26
-rw-r--r--app/assets/javascripts/repository/components/blob_viewers/index.js8
-rw-r--r--app/assets/javascripts/repository/index.js8
-rw-r--r--app/assets/javascripts/repository/mixins/highlight_mixin.js5
-rw-r--r--app/assets/javascripts/vue_shared/components/markdown/header.vue9
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/plugins/index.js4
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/plugins/wrap_lines.js20
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue3
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_utils.js10
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_worker.js (renamed from app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight.js)0
-rw-r--r--app/controllers/projects/blob_controller.rb1
-rw-r--r--app/controllers/projects/tree_controller.rb1
-rw-r--r--app/controllers/projects_controller.rb1
-rw-r--r--app/experiments/concerns/project_commit_count.rb21
-rw-r--r--app/graphql/resolvers/alert_management/http_integrations_resolver.rb2
-rw-r--r--app/graphql/resolvers/alert_management/integrations_resolver.rb2
-rw-r--r--app/graphql/resolvers/concerns/issues/look_ahead_preloads.rb8
-rw-r--r--app/models/issue.rb29
21 files changed, 168 insertions, 116 deletions
diff --git a/app/assets/javascripts/content_editor/components/formatting_toolbar.vue b/app/assets/javascripts/content_editor/components/formatting_toolbar.vue
index b6c16e9f306..4f26ed7fac5 100644
--- a/app/assets/javascripts/content_editor/components/formatting_toolbar.vue
+++ b/app/assets/javascripts/content_editor/components/formatting_toolbar.vue
@@ -1,5 +1,7 @@
<script>
import CommentTemplatesDropdown from '~/vue_shared/components/markdown/comment_templates_dropdown.vue';
+import { __, sprintf } from '~/locale';
+import { getModifierKey } from '~/constants';
import trackUIControl from '../services/track_ui_control';
import ToolbarButton from './toolbar_button.vue';
import ToolbarAttachmentButton from './toolbar_attachment_button.vue';
@@ -32,6 +34,27 @@ export default {
required: false,
},
},
+ data() {
+ const modifierKey = getModifierKey();
+ const shiftKey = modifierKey === '⌘' ? '⇧' : 'Shift+';
+
+ return {
+ i18n: {
+ bold: sprintf(__('Bold (%{modifierKey}B)'), { modifierKey }),
+ italic: sprintf(__('Italic (%{modifierKey}I)'), { modifierKey }),
+ strike: sprintf(__('Strikethrough (%{modifierKey}%{shiftKey}X)'), {
+ modifierKey,
+ shiftKey,
+ }),
+ quote: __('Insert a quote'),
+ code: __('Code'),
+ link: sprintf(__('Insert link (%{modifierKey}K)'), { modifierKey }),
+ bulletList: __('Add a bullet list'),
+ numberedList: __('Add a numbered list'),
+ taskList: __('Add a checklist'),
+ },
+ };
+ },
methods: {
trackToolbarControlExecution({ contentType, value }) {
trackUIControl({ property: contentType, value });
@@ -58,7 +81,7 @@ export default {
content-type="bold"
icon-name="bold"
editor-command="toggleBold"
- :label="__('Bold text')"
+ :label="i18n.bold"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -66,7 +89,7 @@ export default {
content-type="italic"
icon-name="italic"
editor-command="toggleItalic"
- :label="__('Italic text')"
+ :label="i18n.italic"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -74,7 +97,7 @@ export default {
content-type="strike"
icon-name="strikethrough"
editor-command="toggleStrike"
- :label="__('Strikethrough')"
+ :label="i18n.strike"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -82,7 +105,7 @@ export default {
content-type="blockquote"
icon-name="quote"
editor-command="toggleBlockquote"
- :label="__('Insert a quote')"
+ :label="i18n.quote"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -90,7 +113,7 @@ export default {
content-type="code"
icon-name="code"
editor-command="toggleCode"
- :label="__('Code')"
+ :label="i18n.code"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -98,7 +121,7 @@ export default {
content-type="link"
icon-name="link"
editor-command="editLink"
- :label="__('Insert link')"
+ :label="i18n.link"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -107,7 +130,7 @@ export default {
icon-name="list-bulleted"
class="gl-display-none gl-sm-display-inline"
editor-command="toggleBulletList"
- :label="__('Add a bullet list')"
+ :label="i18n.bulletList"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -116,7 +139,7 @@ export default {
icon-name="list-numbered"
class="gl-display-none gl-sm-display-inline"
editor-command="toggleOrderedList"
- :label="__('Add a numbered list')"
+ :label="i18n.numberedList"
@execute="trackToolbarControlExecution"
/>
<toolbar-button
@@ -125,7 +148,7 @@ export default {
icon-name="list-task"
class="gl-display-none gl-sm-display-inline"
editor-command="toggleTaskList"
- :label="__('Add a checklist')"
+ :label="i18n.taskList"
@execute="trackToolbarControlExecution"
/>
<toolbar-table-button data-testid="table" @execute="trackToolbarControlExecution" />
diff --git a/app/assets/javascripts/content_editor/components/toolbar_table_button.vue b/app/assets/javascripts/content_editor/components/toolbar_table_button.vue
index 771455dfe66..ab1546b9016 100644
--- a/app/assets/javascripts/content_editor/components/toolbar_table_button.vue
+++ b/app/assets/javascripts/content_editor/components/toolbar_table_button.vue
@@ -1,5 +1,6 @@
<script>
-import { GlDisclosureDropdown, GlButton, GlTooltipDirective as GlTooltip } from '@gitlab/ui';
+import { GlDisclosureDropdown, GlButton, GlTooltip } from '@gitlab/ui';
+import { uniqueId } from 'lodash';
import { __, sprintf } from '~/locale';
import { clamp } from '../services/utils';
@@ -14,13 +15,12 @@ export default {
components: {
GlButton,
GlDisclosureDropdown,
- },
- directives: {
GlTooltip,
},
inject: ['tiptapEditor'],
data() {
return {
+ toggleId: uniqueId('dropdown-toggle-btn-'),
maxRows: MIN_ROWS,
maxCols: MIN_COLS,
rows: 1,
@@ -82,44 +82,47 @@ export default {
};
</script>
<template>
- <gl-disclosure-dropdown
- ref="dropdown"
- v-gl-tooltip
- size="small"
- category="tertiary"
- icon="table"
- no-caret
- :aria-label="__('Insert table')"
- :toggle-text="__('Insert table')"
- positioning-strategy="fixed"
- class="content-editor-table-dropdown gl-mr-3"
- text-sr-only
- :fluid-width="true"
- @shown="setFocus(1, 1)"
- >
- <div
- class="gl-p-3 gl-pt-2"
- role="grid"
- :aria-colcount="$options.MAX_COLS"
- :aria-rowcount="$options.MAX_ROWS"
+ <div class="gl-display-inline-flex gl-vertical-align-middle">
+ <gl-disclosure-dropdown
+ ref="dropdown"
+ :toggle-id="toggleId"
+ size="small"
+ category="tertiary"
+ icon="table"
+ no-caret
+ :aria-label="__('Insert table')"
+ :toggle-text="__('Insert table')"
+ positioning-strategy="fixed"
+ class="content-editor-table-dropdown gl-mr-3"
+ text-sr-only
+ :fluid-width="true"
+ @shown="setFocus(1, 1)"
>
- <div v-for="r of list(maxRows)" :key="r" class="gl-display-flex" role="row">
- <div v-for="c of list(maxCols)" :key="c" role="gridcell">
- <gl-button
- :ref="`table-${r}-${c}`"
- :class="{ 'active gl-bg-blue-50!': r <= rows && c <= cols }"
- :aria-label="getButtonLabel(r, c)"
- class="table-creator-grid-item gl-display-inline gl-rounded-0! gl-w-6! gl-h-6! gl-p-0!"
- @mouseover="setRowsAndCols(r, c)"
- @focus="setRowsAndCols(r, c)"
- @click="insertTable()"
- @keydown="onKeydown($event.key)"
- />
+ <div
+ class="gl-p-3 gl-pt-2"
+ role="grid"
+ :aria-colcount="$options.MAX_COLS"
+ :aria-rowcount="$options.MAX_ROWS"
+ >
+ <div v-for="r of list(maxRows)" :key="r" class="gl-display-flex" role="row">
+ <div v-for="c of list(maxCols)" :key="c" role="gridcell">
+ <gl-button
+ :ref="`table-${r}-${c}`"
+ :class="{ 'active gl-bg-blue-50!': r <= rows && c <= cols }"
+ :aria-label="getButtonLabel(r, c)"
+ class="table-creator-grid-item gl-display-inline gl-rounded-0! gl-w-6! gl-h-6! gl-p-0!"
+ @mouseover="setRowsAndCols(r, c)"
+ @focus="setRowsAndCols(r, c)"
+ @click="insertTable()"
+ @keydown="onKeydown($event.key)"
+ />
+ </div>
</div>
</div>
- </div>
- <div class="gl-border-t gl-px-4 gl-pt-3 gl-pb-2">
- {{ getButtonLabel(rows, cols) }}
- </div>
- </gl-disclosure-dropdown>
+ <div class="gl-border-t gl-px-4 gl-pt-3 gl-pb-2">
+ {{ getButtonLabel(rows, cols) }}
+ </div>
+ </gl-disclosure-dropdown>
+ <gl-tooltip :target="toggleId" placement="top">{{ __('Insert table') }}</gl-tooltip>
+ </div>
</template>
diff --git a/app/assets/javascripts/pages/projects/blob/show/index.js b/app/assets/javascripts/pages/projects/blob/show/index.js
index f8dcf1a5c9c..0b0399ef271 100644
--- a/app/assets/javascripts/pages/projects/blob/show/index.js
+++ b/app/assets/javascripts/pages/projects/blob/show/index.js
@@ -18,6 +18,7 @@ import { generateRefDestinationPath } from '~/repository/utils/ref_switcher_util
import RefSelector from '~/ref/components/ref_selector.vue';
import { joinPaths, visitUrl } from '~/lib/utils/url_utility';
import { parseBoolean } from '~/lib/utils/common_utils';
+import HighlightWorker from '~/vue_shared/components/source_viewer/workers/highlight_worker?worker';
Vue.use(Vuex);
Vue.use(VueApollo);
@@ -78,6 +79,7 @@ if (viewBlobEl) {
router,
apolloProvider,
provide: {
+ highlightWorker: gon.features.highlightJsWorker ? new HighlightWorker() : null,
targetBranch,
originalBranch,
resourceId,
diff --git a/app/assets/javascripts/repository/components/blob_content_viewer.vue b/app/assets/javascripts/repository/components/blob_content_viewer.vue
index e056a822c8b..3d30b42b2aa 100644
--- a/app/assets/javascripts/repository/components/blob_content_viewer.vue
+++ b/app/assets/javascripts/repository/components/blob_content_viewer.vue
@@ -15,6 +15,7 @@ import CodeIntelligence from '~/code_navigation/components/app.vue';
import LineHighlighter from '~/blob/line_highlighter';
import blobInfoQuery from 'shared_queries/repository/blob_info.query.graphql';
import { addBlameLink } from '~/blob/blob_blame_link';
+import highlightMixin from '~/repository/mixins/highlight_mixin';
import projectInfoQuery from '../queries/project_info.query.graphql';
import getRefMixin from '../mixins/get_ref';
import userInfoQuery from '../queries/user_info.query.graphql';
@@ -36,7 +37,7 @@ export default {
CodeIntelligence,
AiGenie: () => import('ee_component/ai/components/ai_genie.vue'),
},
- mixins: [getRefMixin, glFeatureFlagMixin()],
+ mixins: [getRefMixin, glFeatureFlagMixin(), highlightMixin],
inject: {
originalBranch: {
default: '',
@@ -81,7 +82,10 @@ export default {
shouldFetchRawText: Boolean(this.glFeatures.highlightJs),
};
},
- result() {
+ result({ data }) {
+ const blob = data.project?.repository?.blobs?.nodes[0] || {};
+ this.initHighlightWorker(blob);
+
const urlHash = getLocationHash();
const plain = this.$route?.query?.plain;
@@ -170,7 +174,14 @@ export default {
},
blobViewer() {
const { fileType } = this.viewer;
- return this.shouldLoadLegacyViewer ? null : loadViewer(fileType, this.isUsingLfs);
+ return this.shouldLoadLegacyViewer
+ ? null
+ : loadViewer(
+ fileType,
+ this.isUsingLfs,
+ this.glFeatures.highlightJsWorker,
+ this.blobInfo.language,
+ );
},
shouldLoadLegacyViewer() {
const isTextFile = this.viewer.fileType === TEXT_FILE_TYPE && !this.glFeatures.highlightJs;
@@ -386,7 +397,14 @@ export default {
:loading="isLoadingLegacyViewer"
:data-loading="isRenderingLegacyTextViewer"
/>
- <component :is="blobViewer" v-else :blob="blobInfo" class="blob-viewer" @error="onError" />
+ <component
+ :is="blobViewer"
+ v-else
+ :blob="blobInfo"
+ :chunks="chunks"
+ class="blob-viewer"
+ @error="onError"
+ />
<code-intelligence
v-if="blobViewer || legacyViewerLoaded"
:code-navigation-path="blobInfo.codeNavigationPath"
diff --git a/app/assets/javascripts/repository/components/blob_viewers/index.js b/app/assets/javascripts/repository/components/blob_viewers/index.js
index b749702972f..368f42e0064 100644
--- a/app/assets/javascripts/repository/components/blob_viewers/index.js
+++ b/app/assets/javascripts/repository/components/blob_viewers/index.js
@@ -15,9 +15,15 @@ const viewers = {
geo_json: () => import('./geo_json/geo_json_viewer.vue'),
};
-export const loadViewer = (type, isUsingLfs) => {
+export const loadViewer = (type, isUsingLfs, hljsWorkerEnabled, language) => {
let viewer = viewers[type];
+ if (hljsWorkerEnabled && language === 'json') {
+ // The New Source Viewer currently only supports JSON files.
+ // More language support will be added in: https://gitlab.com/gitlab-org/gitlab/-/issues/415753
+ viewer = () => import('~/vue_shared/components/source_viewer/source_viewer_new.vue');
+ }
+
if (!viewer && isUsingLfs) {
viewer = viewers.lfs;
}
diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js
index befd731a61b..c1e0104c6ac 100644
--- a/app/assets/javascripts/repository/index.js
+++ b/app/assets/javascripts/repository/index.js
@@ -8,6 +8,7 @@ import initWebIdeLink from '~/pages/projects/shared/web_ide_link';
import PerformancePlugin from '~/performance/vue_performance_plugin';
import createStore from '~/code_navigation/store';
import RefSelector from '~/ref/components/ref_selector.vue';
+import HighlightWorker from '~/vue_shared/components/source_viewer/workers/highlight_worker?worker';
import App from './components/app.vue';
import Breadcrumbs from './components/breadcrumbs.vue';
import DirectoryDownloadLinks from './components/directory_download_links.vue';
@@ -290,7 +291,12 @@ export default function setupVueRepositoryList() {
store: createStore(),
router,
apolloProvider,
- provide: { resourceId, userId, explainCodeAvailable: parseBoolean(explainCodeAvailable) },
+ provide: {
+ resourceId,
+ userId,
+ explainCodeAvailable: parseBoolean(explainCodeAvailable),
+ highlightWorker: gon.features.highlightJsWorker ? new HighlightWorker() : null,
+ },
render(h) {
return h(App);
},
diff --git a/app/assets/javascripts/repository/mixins/highlight_mixin.js b/app/assets/javascripts/repository/mixins/highlight_mixin.js
index 95d0c55bb04..232cb0dac03 100644
--- a/app/assets/javascripts/repository/mixins/highlight_mixin.js
+++ b/app/assets/javascripts/repository/mixins/highlight_mixin.js
@@ -1,4 +1,3 @@
-import { nextTick } from 'vue';
import {
LEGACY_FALLBACKS,
EVENT_ACTION,
@@ -39,7 +38,7 @@ export default {
this?.onError();
},
initHighlightWorker({ rawTextBlob, language, simpleViewer }) {
- if (simpleViewer?.fileType !== TEXT_FILE_TYPE) return;
+ if (simpleViewer?.fileType !== TEXT_FILE_TYPE || !this.glFeatures.highlightJsWorker) return;
if (this.isUnsupportedLanguage(language)) {
this.handleUnsupportedLanguage(language);
@@ -97,7 +96,7 @@ export default {
}
// Line numbers in the DOM needs to update first based on changes made to `chunks`.
- await nextTick();
+ await this.$nextTick();
const lineHighlighter = new LineHighlighter({ scrollBehavior: 'auto' });
lineHighlighter.highlightHash(hash);
diff --git a/app/assets/javascripts/vue_shared/components/markdown/header.vue b/app/assets/javascripts/vue_shared/components/markdown/header.vue
index c794ed951ef..0899b752cbc 100644
--- a/app/assets/javascripts/vue_shared/components/markdown/header.vue
+++ b/app/assets/javascripts/vue_shared/components/markdown/header.vue
@@ -97,10 +97,12 @@ export default {
},
},
data() {
+ const modifierKey = getModifierKey();
return {
tag: '> ',
suggestPopoverVisible: false,
- modifierKey: getModifierKey(),
+ modifierKey,
+ shiftKey: modifierKey === '⌘' ? '⇧' : 'Shift+',
};
},
computed: {
@@ -346,8 +348,9 @@ export default {
tag="~~"
:button-title="
/* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */
- sprintf(s__('MarkdownEditor|Add strikethrough text (%{modifierKey}⇧X)'), {
- modifierKey /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */,
+ sprintf(s__('MarkdownEditor|Add strikethrough text (%{modifierKey}%{shiftKey}X)'), {
+ modifierKey,
+ shiftKey /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */,
})
"
:shortcuts="$options.shortcuts.strikethrough"
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/index.js b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/index.js
index d694adf7147..3f8a9258fc3 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/index.js
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/index.js
@@ -1,6 +1,7 @@
import wrapChildNodes from './wrap_child_nodes';
import linkDependencies from './link_dependencies';
import wrapBidiChars from './wrap_bidi_chars';
+import wrapLines from './wrap_lines';
export const HLJS_ON_AFTER_HIGHLIGHT = 'after:highlight';
@@ -11,10 +12,11 @@ export const HLJS_ON_AFTER_HIGHLIGHT = 'after:highlight';
*
* @param {Object} hljs - the Highlight.js instance.
*/
-export const registerPlugins = (hljs, fileType, rawContent) => {
+export const registerPlugins = (hljs, fileType, rawContent, shouldWrapLines) => {
hljs.addPlugin({ [HLJS_ON_AFTER_HIGHLIGHT]: wrapChildNodes });
hljs.addPlugin({ [HLJS_ON_AFTER_HIGHLIGHT]: wrapBidiChars });
hljs.addPlugin({
[HLJS_ON_AFTER_HIGHLIGHT]: (result) => linkDependencies(result, fileType, rawContent),
});
+ if (shouldWrapLines) hljs.addPlugin({ [HLJS_ON_AFTER_HIGHLIGHT]: wrapLines });
};
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/wrap_lines.js b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/wrap_lines.js
new file mode 100644
index 00000000000..384ada30001
--- /dev/null
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/wrap_lines.js
@@ -0,0 +1,20 @@
+/**
+ * Highlight.js plugin for wrapping lines in the correct classes and attributes.
+ * Needed for things like hash highlighting to work.
+ *
+ * Plugin API: https://github.com/highlightjs/highlight.js/blob/main/docs/plugin-api.rst
+ *
+ * @param {Object} Result - an object that represents the highlighted result from Highlight.js
+ */
+
+function wrapLine(content, number, language) {
+ return `<div id="LC${number}" lang="${language}" class="line">${content}</div>`;
+}
+
+export default (result) => {
+ // eslint-disable-next-line no-param-reassign
+ result.value = result.value
+ .split(/\r?\n/)
+ .map((content, index) => wrapLine(content, index + 1, result.language))
+ .join('\n');
+};
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue
index 7e18c8414d5..4d4d15a12b4 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue
@@ -19,9 +19,6 @@ export default {
SafeHtml,
},
mixins: [Tracking.mixin()],
- inject: {
- highlightWorker: { default: null },
- },
props: {
blob: {
type: Object,
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_utils.js b/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_utils.js
index 142c135e9c1..8d8e945cd5f 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_utils.js
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_utils.js
@@ -1,9 +1,13 @@
-import hljs from 'highlight.js';
+import hljs from 'highlight.js/lib/core';
+import json from 'highlight.js/lib/languages/json';
import { registerPlugins } from '../plugins/index';
import { LINES_PER_CHUNK, NEWLINE, ROUGE_TO_HLJS_LANGUAGE_MAP } from '../constants';
-const initHighlightJs = (fileType, content) => {
- registerPlugins(hljs, fileType, content);
+const initHighlightJs = (fileType, content, language) => {
+ // The Highlight Worker is currently scoped to JSON files.
+ // See the following issue for more: https://gitlab.com/gitlab-org/gitlab/-/issues/415753
+ hljs.registerLanguage(language, json);
+ registerPlugins(hljs, fileType, content, true);
};
const splitByLineBreaks = (content = '') => content.split(/\r?\n/);
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight.js b/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_worker.js
index 535e857d7a9..535e857d7a9 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight.js
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/workers/highlight_worker.js
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index a60cc5301e2..b41e4d11d24 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -49,6 +49,7 @@ class Projects::BlobController < Projects::ApplicationController
before_action do
push_frontend_feature_flag(:highlight_js, @project)
+ push_frontend_feature_flag(:highlight_js_worker, @project)
push_frontend_feature_flag(:explain_code_chat, current_user)
push_licensed_feature(:file_locks) if @project.licensed_feature_available?(:file_locks)
end
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index d2a820d93b0..b961339111b 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -19,6 +19,7 @@ class Projects::TreeController < Projects::ApplicationController
before_action do
push_frontend_feature_flag(:highlight_js, @project)
+ push_frontend_feature_flag(:highlight_js_worker, @project)
push_frontend_feature_flag(:explain_code_chat, current_user)
push_licensed_feature(:file_locks) if @project.licensed_feature_available?(:file_locks)
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index bc4831d7772..51f6158d9c0 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -38,6 +38,7 @@ class ProjectsController < Projects::ApplicationController
before_action do
push_frontend_feature_flag(:highlight_js, @project)
+ push_frontend_feature_flag(:highlight_js_worker, @project)
push_frontend_feature_flag(:remove_monitor_metrics, @project)
push_frontend_feature_flag(:explain_code_chat, current_user)
push_frontend_feature_flag(:ci_namespace_catalog_experimental, @project)
diff --git a/app/experiments/concerns/project_commit_count.rb b/app/experiments/concerns/project_commit_count.rb
deleted file mode 100644
index 3f08538c21f..00000000000
--- a/app/experiments/concerns/project_commit_count.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-module ProjectCommitCount
- include Gitlab::Git::WrapsGitalyErrors
-
- def commit_count_for(project, default_count: 0, max_count: nil, **exception_details)
- raw_repo = project.repository&.raw_repository
- root_ref = raw_repo&.root_ref
-
- return default_count unless root_ref
-
- Gitlab::GitalyClient::CommitService.new(raw_repo).commit_count(root_ref, {
- all: true, # include all branches
- max_count: max_count # limit as an optimization
- })
- rescue StandardError => e
- Gitlab::ErrorTracking.track_exception(e, exception_details)
-
- default_count
- end
-end
diff --git a/app/graphql/resolvers/alert_management/http_integrations_resolver.rb b/app/graphql/resolvers/alert_management/http_integrations_resolver.rb
index 225e20bab83..ac04e0967e6 100644
--- a/app/graphql/resolvers/alert_management/http_integrations_resolver.rb
+++ b/app/graphql/resolvers/alert_management/http_integrations_resolver.rb
@@ -35,7 +35,7 @@ module Resolvers
end
def http_integrations
- ::AlertManagement::HttpIntegrationsFinder.new(project, {}).execute
+ ::AlertManagement::HttpIntegrationsFinder.new(project, { type_identifier: :http }).execute
end
end
end
diff --git a/app/graphql/resolvers/alert_management/integrations_resolver.rb b/app/graphql/resolvers/alert_management/integrations_resolver.rb
index a97650e95d9..9b20d3367f1 100644
--- a/app/graphql/resolvers/alert_management/integrations_resolver.rb
+++ b/app/graphql/resolvers/alert_management/integrations_resolver.rb
@@ -40,7 +40,7 @@ module Resolvers
def http_integrations
return [] unless http_integrations_allowed?
- ::AlertManagement::HttpIntegrationsFinder.new(project, {}).execute
+ ::AlertManagement::HttpIntegrationsFinder.new(project, { type_identifier: :http }).execute
end
def prometheus_integrations_allowed?
diff --git a/app/graphql/resolvers/concerns/issues/look_ahead_preloads.rb b/app/graphql/resolvers/concerns/issues/look_ahead_preloads.rb
index 2ea7a02bf15..d9bcf39b818 100644
--- a/app/graphql/resolvers/concerns/issues/look_ahead_preloads.rb
+++ b/app/graphql/resolvers/concerns/issues/look_ahead_preloads.rb
@@ -20,17 +20,15 @@ module Issues
end
def preloads
- preload_hash = {
+ {
alert_management_alert: [:alert_management_alert],
assignees: [:assignees],
participants: Issue.participant_includes,
timelogs: [:timelogs],
customer_relations_contacts: { customer_relations_contacts: [:group] },
- escalation_status: [:incident_management_issuable_escalation_status]
+ escalation_status: [:incident_management_issuable_escalation_status],
+ type: :work_item_type
}
- preload_hash[:type] = :work_item_type if Feature.enabled?(:issue_type_uses_work_item_types_table)
-
- preload_hash
end
end
end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 0afe8916455..453c451cebf 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -204,24 +204,17 @@ class Issue < ApplicationRecord
scope :with_issue_type, ->(types) {
types = Array(types)
- if Feature.enabled?(:issue_type_uses_work_item_types_table)
- # Using != 1 since we also want the guard clause to handle empty arrays
- return joins(:work_item_type).where(work_item_types: { base_type: types }) if types.size != 1
+ # Using != 1 since we also want the guard clause to handle empty arrays
+ return joins(:work_item_type).where(work_item_types: { base_type: types }) if types.size != 1
- where(
- '"issues"."work_item_type_id" = (?)',
- WorkItems::Type.by_type(types.first).select(:id).limit(1)
- )
- else
- where(issue_type: types)
- end
+ # This optimization helps the planer use the correct indexes when filtering by a single type
+ where(
+ '"issues"."work_item_type_id" = (?)',
+ WorkItems::Type.by_type(types.first).select(:id).limit(1)
+ )
}
scope :without_issue_type, ->(types) {
- if Feature.enabled?(:issue_type_uses_work_item_types_table)
- joins(:work_item_type).where.not(work_item_types: { base_type: types })
- else
- where.not(issue_type: types)
- end
+ joins(:work_item_type).where.not(work_item_types: { base_type: types })
}
scope :public_only, -> { where(confidential: false) }
@@ -756,11 +749,7 @@ class Issue < ApplicationRecord
end
def issue_type
- if ::Feature.enabled?(:issue_type_uses_work_item_types_table)
- work_item_type_with_default.base_type
- else
- super
- end
+ work_item_type_with_default.base_type
end
def unsubscribe_email_participant(email)