diff options
Diffstat (limited to 'app')
424 files changed, 1293 insertions, 372 deletions
diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index 080841ee82b..1edaf971afd 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -3,7 +3,7 @@ import { __ } from '~/locale'; import ListLabel from './label'; import ListAssignee from './assignee'; -import ListIssue from './issue'; +import ListIssue from 'ee_else_ce/boards/models/issue'; import { urlParamsToObject } from '~/lib/utils/common_utils'; import boardsStore from '../stores/boards_store'; import ListMilestone from './milestone'; diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 1f213d5aaf2..28850710f80 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -39,6 +39,7 @@ export default class Clusters { updateKnativePath, installPrometheusPath, managePrometheusPath, + clusterEnvironmentsPath, hasRbac, clusterType, clusterStatus, @@ -79,6 +80,7 @@ export default class Clusters { installJupyterEndpoint: installJupyterPath, installKnativeEndpoint: installKnativePath, updateKnativeEndpoint: updateKnativePath, + clusterEnvironmentsEndpoint: clusterEnvironmentsPath, }); this.installApplication = this.installApplication.bind(this); @@ -109,6 +111,10 @@ export default class Clusters { this.initApplications(clusterType); this.initEnvironments(); + if (clusterEnvironmentsPath) { + this.fetchEnvironments(); + } + this.updateContainer(null, this.store.state.status, this.store.state.statusReason); this.addListeners(); @@ -162,6 +168,7 @@ export default class Clusters { render(createElement) { return createElement(Environments, { props: { + isFetching: this.state.fetchingEnvironments, environments: this.state.environments, environmentsHelpPath: this.state.environmentsHelpPath, clustersHelpPath: this.state.clustersHelpPath, @@ -172,6 +179,18 @@ export default class Clusters { }); } + fetchEnvironments() { + this.store.toggleFetchEnvironments(true); + + this.service + .fetchClusterEnvironments() + .then(data => { + this.store.toggleFetchEnvironments(false); + this.store.updateEnvironments(data.data); + }) + .catch(() => Clusters.handleError()); + } + static initDismissableCallout() { const callout = document.querySelector('.js-cluster-security-warning'); PersistentUserCallout.factory(callout); diff --git a/app/assets/javascripts/clusters/services/clusters_service.js b/app/assets/javascripts/clusters/services/clusters_service.js index 01f3732de7e..9139e0beafb 100644 --- a/app/assets/javascripts/clusters/services/clusters_service.js +++ b/app/assets/javascripts/clusters/services/clusters_service.js @@ -33,6 +33,10 @@ export default class ClusterService { return axios.delete(this.appInstallEndpointMap[appId], params); } + fetchClusterEnvironments() { + return axios.get(this.options.clusterEnvironmentsEndpoint); + } + static updateCluster(endpoint, data) { return axios.put(endpoint, data); } diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 83533c88f69..a032f589ee4 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -84,6 +84,7 @@ export default class ClusterStore { }, }, environments: [], + fetchingEnvironments: false, }; } @@ -206,6 +207,10 @@ export default class ClusterStore { }); } + toggleFetchEnvironments(isFetching) { + this.state.fetchingEnvironments = isFetching; + } + updateEnvironments(environments = []) { this.state.environments = environments.map(environment => ({ name: environment.name, @@ -215,7 +220,7 @@ export default class ClusterStore { rolloutStatus: { instances: environment.rollout_status ? environment.rollout_status.instances : [], }, - updatedAt: environment.updatedAt, + updatedAt: environment.updated_at, })); } } diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index bdb50606a53..515402fc506 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -7,6 +7,7 @@ import fuzzaldrinPlus from 'fuzzaldrin-plus'; import axios from './lib/utils/axios_utils'; import { visitUrl } from './lib/utils/url_utility'; import { isObject } from './lib/utils/type_utility'; +import renderItem from './gl_dropdown/render'; var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote, GitLabDropdownInput; @@ -521,8 +522,8 @@ GitLabDropdown = (function() { html.push( this.renderItem( { - header: name, - // Add header for each group + content: name, + type: 'header', }, name, ), @@ -542,16 +543,7 @@ GitLabDropdown = (function() { }; GitLabDropdown.prototype.renderData = function(data, group) { - if (group == null) { - group = false; - } - return data.map( - (function(_this) { - return function(obj, index) { - return _this.renderItem(obj, group, index); - }; - })(this), - ); + return data.map((obj, index) => this.renderItem(obj, group || false, index)); }; GitLabDropdown.prototype.shouldPropagate = function(e) { @@ -688,104 +680,25 @@ GitLabDropdown = (function() { }; GitLabDropdown.prototype.renderItem = function(data, group, index) { - var field, html, selected, text, url, value, rowHidden; - - if (!this.options.renderRow) { - value = this.options.id ? this.options.id(data) : data.id; - - if (value) { - value = value.toString().replace(/'/g, "\\'"); - } - } - - // Hide element - if (this.options.hideRow && this.options.hideRow(value)) { - rowHidden = true; - } - if (group == null) { - group = false; - } - if (index == null) { - // Render the row - index = false; - } - html = document.createElement('li'); - - if (rowHidden) { - html.style.display = 'none'; - } - - if (data === 'divider' || data === 'separator') { - html.className = data; - return html; - } - // Header - if (data.header != null) { - html.className = 'dropdown-header'; - html.innerHTML = data.header; - return html; - } - if (this.options.renderRow) { - // Call the render function - html = this.options.renderRow.call(this.options, data, this); - } else { - if (!selected) { - const { fieldName } = this.options; - - if (value) { - field = this.dropdown.parent().find(`input[name='${fieldName}'][value='${value}']`); - if (field.length) { - selected = true; - } - } else { - field = this.dropdown.parent().find(`input[name='${fieldName}']`); - selected = !field.length; - } - } - // Set URL - if (this.options.url != null) { - url = this.options.url(data); - } else { - url = data.url != null ? data.url : '#'; - } - // Set Text - if (this.options.text != null) { - text = this.options.text(data); - } else { - text = data.text != null ? data.text : ''; - } - if (this.highlight) { - text = data.template - ? this.highlightTemplate(text, data.template) - : this.highlightTextMatches(text, this.filterInput.val()); - } - // Create the list item & the link - var link = document.createElement('a'); - - link.href = url; - - if (this.icon) { - text = `<span>${text}</span>`; - link.classList.add('d-flex', 'align-items-center'); - link.innerHTML = data.icon ? data.icon + text : text; - } else if (this.highlight) { - link.innerHTML = text; - } else { - link.textContent = text; - } - - if (selected) { - link.classList.add('is-active'); - } - - if (group) { - link.dataset.group = group; - link.dataset.index = index; - } - - html.appendChild(link); - } - return html; + let parent; + + if (this.dropdown && this.dropdown[0]) { + parent = this.dropdown[0].parentNode; + } + + return renderItem({ + instance: this, + options: Object.assign({}, this.options, { + icon: this.icon, + highlight: this.highlight, + highlightText: text => this.highlightTextMatches(text, this.filterInput.val()), + highlightTemplate: this.highlightTemplate.bind(this), + parent, + }), + data, + group, + index, + }); }; GitLabDropdown.prototype.highlightTemplate = function(text, template) { @@ -809,7 +722,6 @@ GitLabDropdown = (function() { }; GitLabDropdown.prototype.noResults = function() { - var html; return '<li class="dropdown-menu-empty-item"><a>No matching results</a></li>'; }; diff --git a/app/assets/javascripts/gl_dropdown/render.js b/app/assets/javascripts/gl_dropdown/render.js new file mode 100644 index 00000000000..66546aa834f --- /dev/null +++ b/app/assets/javascripts/gl_dropdown/render.js @@ -0,0 +1,158 @@ +const renderersByType = { + divider(element) { + element.classList.add('divider'); + + return element; + }, + separator(element) { + element.classList.add('separator'); + + return element; + }, + header(element, data) { + element.classList.add('dropdown-header'); + element.innerHTML = data.content; + + return element; + }, +}; + +function getPropertyWithDefault(data, options, property, defaultValue = '') { + let result; + + if (options[property] != null) { + result = options[property](data); + } else { + result = data[property] != null ? data[property] : defaultValue; + } + + return result; +} + +function getHighlightTextBuilder(text, data, options) { + if (options.highlight) { + return data.template + ? options.highlightTemplate(text, data.template) + : options.highlightText(text); + } + + return text; +} + +function getIconTextBuilder(text, data, options) { + if (options.icon) { + const wrappedText = `<span>${text}</span>`; + return data.icon ? `${data.icon}${wrappedText}` : wrappedText; + } + + return text; +} + +function getLinkText(data, options) { + const text = getPropertyWithDefault(data, options, 'text'); + + return [getHighlightTextBuilder, getIconTextBuilder].reduce( + (acc, fn) => fn(acc, data, options), + text, + ); +} + +function escape(text) { + return text ? String(text).replace(/'/g, "\\'") : text; +} + +function getOptionValue(data, options) { + if (options.renderRow) { + return undefined; + } + + return escape(options.id ? options.id(data) : data.id); +} + +function shouldHide(data, { options }) { + const value = getOptionValue(data, options); + + return options.hideRow && options.hideRow(value); +} + +function hideElement(element) { + element.style.display = 'none'; + + return element; +} + +function checkSelected(data, options) { + const value = getOptionValue(data, options); + + if (!options.parent) { + return !data.id; + } else if (value) { + return ( + options.parent.querySelector(`input[name='${options.fieldName}'][value='${value}']`) != null + ); + } + + return options.parent.querySelector(`input[name='${options.fieldName}']`) == null; +} + +function createLink(url, selected, options) { + const link = document.createElement('a'); + + link.href = url; + + if (options.icon) { + link.classList.add('d-flex', 'align-items-center'); + } + + link.classList.toggle('is-active', selected); + + return link; +} + +function assignTextToLink(el, data, options) { + const text = getLinkText(data, options); + + if (options.icon || options.highlight) { + el.innerHTML = text; + } else { + el.textContent = text; + } + + return el; +} + +function renderLink(row, data, { options, group, index }) { + const selected = checkSelected(data, options); + const url = getPropertyWithDefault(data, options, 'url', '#'); + const link = createLink(url, selected, options); + + assignTextToLink(link, data, options); + + if (group) { + link.dataset.group = group; + link.dataset.index = index; + } + + row.appendChild(link); + + return row; +} + +function getOptionRenderer({ options, instance }) { + return options.renderRow && ((li, data) => options.renderRow(data, instance)); +} + +function getRenderer(data, params) { + return renderersByType[data.type] || getOptionRenderer(params) || renderLink; +} + +export default function item({ data, ...params }) { + const renderer = getRenderer(data, params); + const li = document.createElement('li'); + + if (shouldHide(data, params)) { + hideElement(li); + } + + return renderer(li, data, params); +} diff --git a/app/assets/javascripts/groups/transfer_dropdown.js b/app/assets/javascripts/groups/transfer_dropdown.js index cec824a529c..e94b163dfb1 100644 --- a/app/assets/javascripts/groups/transfer_dropdown.js +++ b/app/assets/javascripts/groups/transfer_dropdown.js @@ -14,7 +14,7 @@ export default class TransferDropdown { } buildDropdown() { - const extraOptions = [{ id: '-1', text: __('No parent group') }, 'divider']; + const extraOptions = [{ id: '-1', text: __('No parent group') }, { type: 'divider' }]; this.groupDropdown.glDropdown({ selectable: true, diff --git a/app/assets/javascripts/jobs/components/environments_block.vue b/app/assets/javascripts/jobs/components/environments_block.vue index 132e50e5715..8cda7dac51f 100644 --- a/app/assets/javascripts/jobs/components/environments_block.vue +++ b/app/assets/javascripts/jobs/components/environments_block.vue @@ -79,7 +79,9 @@ export default { default: break; } - return environmentText; + return environmentText && this.hasCluster + ? `${environmentText} ${this.clusterText}` + : environmentText; }, environmentLink() { if (this.hasEnvironment) { @@ -109,6 +111,37 @@ export default { ? this.lastDeployment.deployable.build_path : ''; }, + hasCluster() { + return this.hasLastDeployment && this.lastDeployment.cluster; + }, + clusterNameOrLink() { + if (!this.hasCluster) { + return ''; + } + + const { name, path } = this.lastDeployment.cluster; + const escapedName = _.escape(name); + const escapedPath = _.escape(path); + + if (!escapedPath) { + return escapedName; + } + + return sprintf( + '%{startLink}%{name}%{endLink}', + { + startLink: `<a href="${escapedPath}" class="js-job-cluster-link">`, + name: escapedName, + endLink: '</a>', + }, + false, + ); + }, + clusterText() { + return this.hasCluster + ? sprintf(__('Cluster %{cluster} was used.'), { cluster: this.clusterNameOrLink }, false) + : ''; + }, }, methods: { deploymentLink(name) { diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index f50a6e3b19d..177aa02b8e0 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -231,7 +231,7 @@ export default class LabelsSelect { }); } if (extraData.length) { - extraData.push('divider'); + extraData.push({ type: 'divider' }); data = extraData.concat(data); } } @@ -243,7 +243,7 @@ export default class LabelsSelect { }) .catch(() => flash(__('Error fetching labels.'))); }, - renderRow: function(label, instance) { + renderRow: function(label) { var linkEl, listItemEl, color, diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index 43949d5cc86..8f077685b07 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -100,7 +100,7 @@ export default class MilestoneSelect { }); } if (extraOptions.length) { - extraOptions.push('divider'); + extraOptions.push({ type: 'divider' }); } callback(extraOptions.concat(data)); diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index 03d349ac714..2ef081837e6 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -34,7 +34,7 @@ export default class NamespaceSelect { id: null, }; namespaces.unshift(anyNamespace); - namespaces.splice(1, 0, 'divider'); + namespaces.splice(1, 0, { type: 'divider' }); } return dataCallback(namespaces); }); diff --git a/app/assets/javascripts/pages/profiles/two_factor_auths/index.js b/app/assets/javascripts/pages/profiles/two_factor_auths/index.js index 0d377eb9c68..95936c2d1db 100644 --- a/app/assets/javascripts/pages/profiles/two_factor_auths/index.js +++ b/app/assets/javascripts/pages/profiles/two_factor_auths/index.js @@ -7,7 +7,7 @@ document.addEventListener('DOMContentLoaded', () => { const skippable = parseBoolean(twoFactorNode.dataset.twoFactorSkippable); if (skippable) { - const button = `<a class="btn btn-sm btn-warning float-right" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`; + const button = `<a class="btn btn-sm btn-warning float-right" data-qa-selector="configure_it_later_button" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`; const flashAlert = document.querySelector('.flash-alert'); if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button); } diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue index ea867d30ce8..89cac42abae 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue +++ b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue @@ -215,6 +215,7 @@ export default { :disabled="!canChangeVisibilityLevel" name="project[visibility_level]" class="form-control select-control" + data-qa-selector="project_visibility_dropdown" > <option :value="visibilityOptions.PRIVATE" diff --git a/app/assets/javascripts/pages/search/show/search.js b/app/assets/javascripts/pages/search/show/search.js index 86ec78e1df8..8f6c48ab065 100644 --- a/app/assets/javascripts/pages/search/show/search.js +++ b/app/assets/javascripts/pages/search/show/search.js @@ -30,7 +30,7 @@ export default class Search { data.unshift({ full_name: __('Any'), }); - data.splice(1, 0, 'divider'); + data.splice(1, 0, { type: 'divider' }); return callback(data); }); }, @@ -57,7 +57,7 @@ export default class Search { data.unshift({ name_with_namespace: __('Any'), }); - data.splice(1, 0, 'divider'); + data.splice(1, 0, { type: 'divider' }); return data; }) diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 842fb5e5b4f..510a2441924 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -191,13 +191,14 @@ export class SearchAutocomplete { // Add group header before list each group if (lastCategory !== suggestion.category) { if (!firstCategory) { - data.push('separator'); + data.push({ type: 'separator' }); } if (firstCategory) { firstCategory = false; } data.push({ - header: suggestion.category, + type: 'header', + content: suggestion.category, }); lastCategory = suggestion.category; } @@ -221,7 +222,7 @@ export class SearchAutocomplete { template = s__('SearchAutocomplete|in this group'); } - data.unshift('separator'); + data.unshift({ type: 'separator' }); data.unshift({ icon, text: term, @@ -271,7 +272,8 @@ export class SearchAutocomplete { if (name) { baseItems.push({ - header: `${name}`, + type: 'header', + content: `${name}`, }); } diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index 12c939aa70f..57efde7f027 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) { } if (showDivider) { - users.splice(showDivider, 0, 'divider'); + users.splice(showDivider, 0, { type: 'divider' }); } if ($dropdown.hasClass('js-multiselect')) { @@ -343,7 +343,8 @@ function UsersSelect(currentUser, els, options = {}) { if ($dropdown.data('dropdownHeader')) { showDivider += 1; users.splice(showDivider, 0, { - header: $dropdown.data('dropdownHeader'), + type: 'header', + content: $dropdown.data('dropdownHeader'), }); } @@ -358,7 +359,7 @@ function UsersSelect(currentUser, els, options = {}) { users.splice(showDivider, 0, selectedUser); }); - users.splice(showDivider + 1, 0, 'divider'); + users.splice(showDivider + 1, 0, { type: 'divider' }); } } } diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue index 4b5201bbca7..52acd1de666 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue @@ -95,7 +95,6 @@ export default { }, }; </script> - <template> <div class="ci-widget media js-ci-widget"> <template v-if="!hasPipeline || hasCIError"> @@ -157,6 +156,7 @@ export default { </div> </template> </span> + <linked-pipelines-mini-list v-if="triggered.length" :triggered="triggered" /> </span> </div> diff --git a/app/assets/javascripts/vue_shared/components/gl_countdown.vue b/app/assets/javascripts/vue_shared/components/gl_countdown.vue index c1aace31fb2..4aae3549601 100644 --- a/app/assets/javascripts/vue_shared/components/gl_countdown.vue +++ b/app/assets/javascripts/vue_shared/components/gl_countdown.vue @@ -9,6 +9,7 @@ export default { directives: { GlTooltip: GlTooltipDirective, }, + props: { endDateString: { type: String, diff --git a/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue b/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue index 4dcc121496c..c1f3d86335a 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue @@ -77,12 +77,11 @@ export default { </script> <template> - <div class="block sidebar-grouped-item"> + <div class="block sidebar-grouped-item gl-cursor-pointer" role="button" @click="toggleSidebar"> <collapsed-calendar-icon v-if="showMinDateBlock" :container-class="iconClass" :tooltip-text="tooltipText('min')" - @click="toggleSidebar" > <span class="sidebar-collapsed-value"> <span v-if="showFromText">{{ __('From') }}</span> <span>{{ dateText('min') }}</span> @@ -93,7 +92,6 @@ export default { v-if="maxDate" :container-class="iconClass" :tooltip-text="tooltipText('max')" - @click="toggleSidebar" > <span class="sidebar-collapsed-value"> <span v-if="!minDate">{{ __('Until') }}</span> <span>{{ dateText('max') }}</span> diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index b742b7e19cf..956e03cef07 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -8,3 +8,5 @@ class Admin::ApplicationController < ApplicationController layout 'admin' end + +Admin::ApplicationController.prepend_if_ee('EE::Admin::ApplicationController') diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index f2f72bea5b4..dc16ad80980 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -149,3 +149,5 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController render action end end + +Admin::ApplicationSettingsController.prepend_if_ee('EE::Admin::ApplicationSettingsController') diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 64b959e2431..c36bbaab23b 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -14,3 +14,5 @@ class Admin::DashboardController < Admin::ApplicationController end # rubocop: enable CodeReuse/ActiveRecord end + +Admin::DashboardController.prepend_if_ee('EE::Admin::DashboardController') diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 32a36da56fe..85a37fcd43e 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -99,3 +99,5 @@ class Admin::GroupsController < Admin::ApplicationController ] end end + +Admin::GroupsController.prepend_if_ee('EE::Admin::GroupsController') diff --git a/app/controllers/admin/health_check_controller.rb b/app/controllers/admin/health_check_controller.rb index 7cd80e8b5e1..7668c799cba 100644 --- a/app/controllers/admin/health_check_controller.rb +++ b/app/controllers/admin/health_check_controller.rb @@ -11,3 +11,5 @@ class Admin::HealthCheckController < Admin::ApplicationController ['standard'] end end + +Admin::HealthCheckController.prepend_if_ee('EE::Admin::HealthCheckController') diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb index 704e727b1da..14245300633 100644 --- a/app/controllers/admin/logs_controller.rb +++ b/app/controllers/admin/logs_controller.rb @@ -20,3 +20,5 @@ class Admin::LogsController < Admin::ApplicationController ] end end + +Admin::LogsController.prepend_if_ee('EE::Admin::LogsController') diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 70db15916b9..0e8c69eb7d6 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -76,3 +76,5 @@ class Admin::ProjectsController < Admin::ApplicationController @group ||= @project.group end end + +Admin::ProjectsController.prepend_if_ee('EE::Admin::ProjectsController') diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 98883af6286..61d36d1efc2 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -241,3 +241,5 @@ class Admin::UsersController < Admin::ApplicationController Gitlab::AppLogger.info(_("User %{current_user_username} has started impersonating %{username}") % { current_user_username: current_user.username, username: user.username }) end end + +Admin::UsersController.prepend_if_ee('EE::Admin::UsersController') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2f7ac41781a..9a7859fc687 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -534,3 +534,5 @@ class ApplicationController < ActionController::Base end end end + +ApplicationController.prepend_if_ee('EE::ApplicationController') diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb index 30a567c3bef..06531932b31 100644 --- a/app/controllers/autocomplete_controller.rb +++ b/app/controllers/autocomplete_controller.rb @@ -46,3 +46,5 @@ class AutocompleteController < ApplicationController render json: target_branches.map { |target_branch| { title: target_branch } } end end + +AutocompleteController.prepend_if_ee('EE::AutocompleteController') diff --git a/app/controllers/boards/lists_controller.rb b/app/controllers/boards/lists_controller.rb index 08b4748d7e1..7633e2aedd2 100644 --- a/app/controllers/boards/lists_controller.rb +++ b/app/controllers/boards/lists_controller.rb @@ -87,3 +87,5 @@ module Boards end end end + +Boards::ListsController.prepend_if_ee('EE::Boards::ListsController') diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb index 97f59da7885..b55061b5dc6 100644 --- a/app/controllers/clusters/clusters_controller.rb +++ b/app/controllers/clusters/clusters_controller.rb @@ -244,3 +244,5 @@ class Clusters::ClustersController < Clusters::BaseController @cluster.applications.each(&:schedule_status_update) end end + +Clusters::ClustersController.prepend_if_ee('EE::Clusters::ClustersController') diff --git a/app/controllers/concerns/boards_actions.rb b/app/controllers/concerns/boards_actions.rb index e4123d87137..a093d0d6e7f 100644 --- a/app/controllers/concerns/boards_actions.rb +++ b/app/controllers/concerns/boards_actions.rb @@ -44,3 +44,5 @@ module BoardsActions serializer.represent(resource, serializer: 'board', include_full_project_path: board.group_board?) end end + +BoardsActions.prepend_if_ee('EE::BoardsActions') diff --git a/app/controllers/concerns/boards_responses.rb b/app/controllers/concerns/boards_responses.rb index 9da2f888ead..d8bc1320db4 100644 --- a/app/controllers/concerns/boards_responses.rb +++ b/app/controllers/concerns/boards_responses.rb @@ -86,3 +86,5 @@ module BoardsResponses BoardSerializer.new end end + +BoardsResponses.prepend_if_ee('EE::BoardsResponses') diff --git a/app/controllers/concerns/cycle_analytics_params.rb b/app/controllers/concerns/cycle_analytics_params.rb index c1ef848e1e7..b970bdc544e 100644 --- a/app/controllers/concerns/cycle_analytics_params.rb +++ b/app/controllers/concerns/cycle_analytics_params.rb @@ -18,3 +18,5 @@ module CycleAnalyticsParams end end end + +CycleAnalyticsParams.prepend_if_ee('EE::CycleAnalyticsParams') diff --git a/app/controllers/concerns/internal_redirect.rb b/app/controllers/concerns/internal_redirect.rb index fa3716502a0..99bbfd56516 100644 --- a/app/controllers/concerns/internal_redirect.rb +++ b/app/controllers/concerns/internal_redirect.rb @@ -45,3 +45,5 @@ module InternalRedirect URI(request.referer).path end end + +InternalRedirect.prepend_if_ee('EE::InternalRedirect') diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index e537c11096c..543a27c56d4 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -260,3 +260,5 @@ module IssuableActions end # rubocop:enable Gitlab/ModuleWithInstanceVariables end + +IssuableActions.prepend_if_ee('EE::IssuableActions') diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index 88044cf7557..c9a8de0b290 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -153,3 +153,5 @@ module IssuableCollections end # rubocop:enable Gitlab/ModuleWithInstanceVariables end + +IssuableCollections.prepend_if_ee('EE::IssuableCollections') diff --git a/app/controllers/concerns/lfs_request.rb b/app/controllers/concerns/lfs_request.rb index bff0715f192..733265f4099 100644 --- a/app/controllers/concerns/lfs_request.rb +++ b/app/controllers/concerns/lfs_request.rb @@ -128,3 +128,5 @@ module LfsRequest false end end + +LfsRequest.prepend_if_ee('EE::LfsRequest') diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index ff9b0332c97..45f9888a040 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -55,3 +55,5 @@ module RoutableActions end end end + +RoutableActions.prepend_if_ee('EE::RoutableActions') diff --git a/app/controllers/concerns/service_params.rb b/app/controllers/concerns/service_params.rb index 48451bedcc2..b07ddd6f684 100644 --- a/app/controllers/concerns/service_params.rb +++ b/app/controllers/concerns/service_params.rb @@ -85,3 +85,5 @@ module ServiceParams ALLOWED_PARAMS_CE end end + +ServiceParams.prepend_if_ee('EE::ServiceParams') diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index b192189ba3c..21ee76d31b2 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -31,3 +31,5 @@ class ConfirmationsController < Devise::ConfirmationsController after_sign_in_path_for(resource) end end + +ConfirmationsController.prepend_if_ee('EE::ConfirmationsController') diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 1dc89943f7f..6457732dff0 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -100,3 +100,5 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController Project::SORTING_PREFERENCE_FIELD end end + +Dashboard::ProjectsController.prepend_if_ee('EE::Dashboard::ProjectsController') diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb index 5f92333c2c3..d03a50f6f77 100644 --- a/app/controllers/groups/application_controller.rb +++ b/app/controllers/groups/application_controller.rb @@ -38,3 +38,5 @@ class Groups::ApplicationController < ApplicationController url_for(safe_params) end end + +Groups::ApplicationController.prepend_if_ee('EE::Groups::ApplicationController') diff --git a/app/controllers/groups/clusters_controller.rb b/app/controllers/groups/clusters_controller.rb index 92602fd8096..2165dee45fb 100644 --- a/app/controllers/groups/clusters_controller.rb +++ b/app/controllers/groups/clusters_controller.rb @@ -18,3 +18,5 @@ class Groups::ClustersController < Clusters::ClustersController @group ||= find_routable!(Group, params[:group_id] || params[:id]) end end + +Groups::ClustersController.prepend_if_ee('EE::Groups::ClustersController') diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 557888711ec..1b1416a72d7 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -53,3 +53,5 @@ class Groups::GroupMembersController < Groups::ApplicationController # MembershipActions concern alias_method :membershipable, :group end + +Groups::GroupMembersController.prepend_if_ee('EE::Groups::GroupMembersController') diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 7ed4384089b..58df6f66d50 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -118,3 +118,5 @@ class Groups::MilestonesController < Groups::ApplicationController params.permit(:state, :search_title).merge(group_ids: group.id) end end + +Groups::MilestonesController.prepend_if_ee('EE::Groups::MilestonesController') diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 886d1f99d69..95a7876a055 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -133,7 +133,7 @@ class GroupsController < Groups::ApplicationController protected def render_show_html - render 'groups/show' + render 'groups/show', locals: { trial: params[:trial] } end def render_details_html @@ -229,3 +229,5 @@ class GroupsController < Groups::ApplicationController url_for(safe_params) end end + +GroupsController.prepend_if_ee('EE::GroupsController') diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb index af1e6cc703b..4c9aac9a327 100644 --- a/app/controllers/ide_controller.rb +++ b/app/controllers/ide_controller.rb @@ -7,3 +7,5 @@ class IdeController < ApplicationController Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count end end + +IdeController.prepend_if_ee('EE::IdeController') diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index ebb50fc8b10..1cea0299fb2 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -186,3 +186,5 @@ class Import::GithubController < Import::BaseController {} end end + +Import::GithubController.prepend_if_ee('EE::Import::GithubController') diff --git a/app/controllers/ldap/omniauth_callbacks_controller.rb b/app/controllers/ldap/omniauth_callbacks_controller.rb index 9a5a45939e0..4d8875937eb 100644 --- a/app/controllers/ldap/omniauth_callbacks_controller.rb +++ b/app/controllers/ldap/omniauth_callbacks_controller.rb @@ -31,3 +31,5 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController redirect_to new_user_session_path end end + +Ldap::OmniauthCallbacksController.prepend_if_ee('EE::Ldap::OmniauthCallbacksController') diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index b1efa767154..da92df89aed 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -214,3 +214,5 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end end end + +OmniauthCallbacksController.prepend_if_ee('EE::OmniauthCallbacksController') diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 77de5cb45c9..af860297358 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -64,3 +64,5 @@ class PasswordsController < Devise::PasswordsController notice: I18n.t('devise.passwords.send_paranoid_instructions') end end + +PasswordsController.prepend_if_ee('EE::PasswordsController') diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb index b03f4b7435f..95e055a44db 100644 --- a/app/controllers/profiles/accounts_controller.rb +++ b/app/controllers/profiles/accounts_controller.rb @@ -30,3 +30,5 @@ class Profiles::AccountsController < Profiles::ApplicationController {} end end + +Profiles::AccountsController.prepend_if_ee('EE::Profiles::AccountsController') diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index 62f98d9e549..046ae5d9a51 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -50,3 +50,5 @@ class Profiles::PreferencesController < Profiles::ApplicationController ] end end + +Profiles::PreferencesController.prepend_if_ee('::EE::Profiles::PreferencesController') diff --git a/app/controllers/projects/autocomplete_sources_controller.rb b/app/controllers/projects/autocomplete_sources_controller.rb index 0e3f13045ce..605d70d440b 100644 --- a/app/controllers/projects/autocomplete_sources_controller.rb +++ b/app/controllers/projects/autocomplete_sources_controller.rb @@ -43,3 +43,5 @@ class Projects::AutocompleteSourcesController < Projects::ApplicationController .execute(params[:type], params[:type_id]) end end + +Projects::AutocompleteSourcesController.prepend_if_ee('EE::Projects::AutocompleteSourcesController') diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 5a1f93dc609..7f776b8b497 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -260,3 +260,5 @@ class Projects::EnvironmentsController < Projects::ApplicationController access_denied! unless can?(current_user, :stop_environment, environment) end end + +Projects::EnvironmentsController.prepend_if_ee('EE::Projects::EnvironmentsController') diff --git a/app/controllers/projects/git_http_client_controller.rb b/app/controllers/projects/git_http_client_controller.rb index abf8407a51c..a597cc9af32 100644 --- a/app/controllers/projects/git_http_client_controller.rb +++ b/app/controllers/projects/git_http_client_controller.rb @@ -119,3 +119,5 @@ class Projects::GitHttpClientController < Projects::ApplicationController Gitlab::ProtocolAccess.allowed?('http') end end + +Projects::GitHttpClientController.prepend_if_ee('EE::Projects::GitHttpClientController') diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb index e519cc1f158..0c8c03cb16a 100644 --- a/app/controllers/projects/git_http_controller.rb +++ b/app/controllers/projects/git_http_controller.rb @@ -110,3 +110,5 @@ class Projects::GitHttpController < Projects::GitHttpClientController Users::ActivityService.new(user, 'pull').execute end end + +Projects::GitHttpController.prepend_if_ee('EE::Projects::GitHttpController') diff --git a/app/controllers/projects/group_links_controller.rb b/app/controllers/projects/group_links_controller.rb index dc65f9959db..d06e24ef39c 100644 --- a/app/controllers/projects/group_links_controller.rb +++ b/app/controllers/projects/group_links_controller.rb @@ -53,3 +53,5 @@ class Projects::GroupLinksController < Projects::ApplicationController params.permit(:link_group_access, :expires_at) end end + +Projects::GroupLinksController.prepend_if_ee('EE::Projects::GroupLinksController') diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb index da32ab9e2e0..67a7daf8445 100644 --- a/app/controllers/projects/imports_controller.rb +++ b/app/controllers/projects/imports_controller.rb @@ -73,3 +73,5 @@ class Projects::ImportsController < Projects::ApplicationController .merge(import_url_params) end end + +Projects::ImportsController.prepend_if_ee('EE::Projects::ImportsController') diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index b7fd286bfe0..9cdd6288000 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -280,3 +280,5 @@ class Projects::IssuesController < Projects::ApplicationController Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42422') end end + +Projects::IssuesController.prepend_if_ee('EE::Projects::IssuesController') diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index 06d7579aff4..c83d4e307a7 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -231,3 +231,5 @@ class Projects::JobsController < Projects::ApplicationController 'attachment' end end + +Projects::JobsController.prepend_if_ee('EE::Projects::JobsController') diff --git a/app/controllers/projects/lfs_api_controller.rb b/app/controllers/projects/lfs_api_controller.rb index c16736a756a..739f7a2437e 100644 --- a/app/controllers/projects/lfs_api_controller.rb +++ b/app/controllers/projects/lfs_api_controller.rb @@ -123,3 +123,5 @@ class Projects::LfsApiController < Projects::GitHttpClientController _('You cannot write to this read-only GitLab instance.') end end + +Projects::LfsApiController.prepend_if_ee('EE::Projects::LfsApiController') diff --git a/app/controllers/projects/merge_requests/application_controller.rb b/app/controllers/projects/merge_requests/application_controller.rb index 006731c0e66..edffeb32203 100644 --- a/app/controllers/projects/merge_requests/application_controller.rb +++ b/app/controllers/projects/merge_requests/application_controller.rb @@ -59,3 +59,5 @@ class Projects::MergeRequests::ApplicationController < Projects::ApplicationCont @merge_request.close end end + +Projects::MergeRequests::ApplicationController.prepend_if_ee('EE::Projects::MergeRequests::ApplicationController') diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb index 456d2c34768..9c5caf7719e 100644 --- a/app/controllers/projects/merge_requests/diffs_controller.rb +++ b/app/controllers/projects/merge_requests/diffs_controller.rb @@ -117,3 +117,5 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic @notes end end + +Projects::MergeRequests::DiffsController.prepend_if_ee('EE::Projects::MergeRequests::DiffsController') diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index ea1dd7d19d5..2a58cfb8f6b 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -351,3 +351,5 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo return render_404 unless can?(current_user, :read_build, merge_request.actual_head_pipeline) end end + +Projects::MergeRequestsController.prepend_if_ee('EE::Projects::MergeRequestsController') diff --git a/app/controllers/projects/mirrors_controller.rb b/app/controllers/projects/mirrors_controller.rb index 6c6adc233b7..dd1ea151de7 100644 --- a/app/controllers/projects/mirrors_controller.rb +++ b/app/controllers/projects/mirrors_controller.rb @@ -90,3 +90,5 @@ class Projects::MirrorsController < Projects::ApplicationController params.require(:project).permit(mirror_params_attributes) end end + +Projects::MirrorsController.prepend_if_ee('EE::Projects::MirrorsController') diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 499d4918899..28c25dbc1e6 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -220,3 +220,5 @@ class Projects::PipelinesController < Projects::ApplicationController view_context.limited_counter_with_delimiter(finder.execute) end end + +Projects::PipelinesController.prepend_if_ee('EE::Projects::PipelinesController') diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 8938cfbad54..b01d48ca3d3 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -51,3 +51,5 @@ class Projects::ProjectMembersController < Projects::ApplicationController # MembershipActions concern alias_method :membershipable, :project end + +Projects::ProjectMembersController.prepend_if_ee('EE::Projects::ProjectMembersController') diff --git a/app/controllers/projects/prometheus/metrics_controller.rb b/app/controllers/projects/prometheus/metrics_controller.rb index 3a9f9aab4a5..267dca74f96 100644 --- a/app/controllers/projects/prometheus/metrics_controller.rb +++ b/app/controllers/projects/prometheus/metrics_controller.rb @@ -32,3 +32,5 @@ module Projects end end end + +Projects::Prometheus::MetricsController.prepend_if_ee('EE::Projects::Prometheus::MetricsController') diff --git a/app/controllers/projects/protected_refs_controller.rb b/app/controllers/projects/protected_refs_controller.rb index 4e2a9df5576..d9921757502 100644 --- a/app/controllers/projects/protected_refs_controller.rb +++ b/app/controllers/projects/protected_refs_controller.rb @@ -65,3 +65,5 @@ class Projects::ProtectedRefsController < Projects::ApplicationController %i[access_level id] end end + +Projects::ProtectedRefsController.prepend_if_ee('EE::Projects::ProtectedRefsController') diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index d69f9e65874..2ed29b937ad 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -90,3 +90,5 @@ class Projects::RepositoriesController < Projects::ApplicationController render_404 end end + +Projects::RepositoriesController.prepend_if_ee('EE::Projects::RepositoriesController') diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb index 1b8d479209b..0d61c3cc031 100644 --- a/app/controllers/projects/settings/ci_cd_controller.rb +++ b/app/controllers/projects/settings/ci_cd_controller.rb @@ -122,3 +122,5 @@ module Projects end end end + +Projects::Settings::CiCdController.prepend_if_ee('EE::Projects::Settings::CiCdController') diff --git a/app/controllers/projects/settings/integrations_controller.rb b/app/controllers/projects/settings/integrations_controller.rb index 388fcb32c35..0c5cf01d912 100644 --- a/app/controllers/projects/settings/integrations_controller.rb +++ b/app/controllers/projects/settings/integrations_controller.rb @@ -25,3 +25,5 @@ module Projects end end end + +Projects::Settings::IntegrationsController.prepend_if_ee('EE::Projects::Settings::IntegrationsController') diff --git a/app/controllers/projects/settings/operations_controller.rb b/app/controllers/projects/settings/operations_controller.rb index ec89bb89edc..7c71486a765 100644 --- a/app/controllers/projects/settings/operations_controller.rb +++ b/app/controllers/projects/settings/operations_controller.rb @@ -69,3 +69,5 @@ module Projects end end end + +Projects::Settings::OperationsController.prepend_if_ee('::EE::Projects::Settings::OperationsController') diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index bc2ce15286f..0c634bbea03 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -104,3 +104,5 @@ module Projects end end end + +Projects::Settings::RepositoryController.prepend_if_ee('EE::Projects::Settings::RepositoryController') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5f335de4d6b..a6ed783b433 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -464,3 +464,5 @@ class ProjectsController < Projects::ApplicationController @project = @project.present(current_user: current_user) end end + +ProjectsController.prepend_if_ee('EE::ProjectsController') diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index fb631f09f10..a973ed23da9 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -145,3 +145,5 @@ class RegistrationsController < Devise::RegistrationsController stored_location_for(user) || dashboard_projects_path end end + +RegistrationsController.prepend_if_ee('EE::RegistrationsController') diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index f1b39125a48..310ae17abbf 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -62,3 +62,5 @@ class RootController < Dashboard::ProjectsController root_urls.exclude?(home_page_url) end end + +RootController.prepend_if_ee('EE::RootController') diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb index 77757c4a3ef..51a67cd2e3b 100644 --- a/app/controllers/sent_notifications_controller.rb +++ b/app/controllers/sent_notifications_controller.rb @@ -36,3 +36,5 @@ class SentNotificationsController < ApplicationController end end end + +SentNotificationsController.prepend_if_ee('EE::SentNotificationsController') diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index a6dd811ab8b..f8da152e3d2 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -288,3 +288,5 @@ class SessionsController < Devise::SessionsController end end end + +SessionsController.prepend_if_ee('EE::SessionsController') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e38d4073de3..c3c227b08c5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -182,3 +182,5 @@ class UsersController < ApplicationController access_denied! unless can?(current_user, :read_user_profile, user) end end + +UsersController.prepend_if_ee('EE::UsersController') diff --git a/app/finders/autocomplete/users_finder.rb b/app/finders/autocomplete/users_finder.rb index ce7d0b8699c..8dc3c2320ed 100644 --- a/app/finders/autocomplete/users_finder.rb +++ b/app/finders/autocomplete/users_finder.rb @@ -93,3 +93,5 @@ module Autocomplete end end end + +Autocomplete::UsersFinder.prepend_if_ee('EE::Autocomplete::UsersFinder') diff --git a/app/finders/group_members_finder.rb b/app/finders/group_members_finder.rb index 33ec6a715f9..165d9adae31 100644 --- a/app/finders/group_members_finder.rb +++ b/app/finders/group_members_finder.rb @@ -34,3 +34,5 @@ class GroupMembersFinder < UnionFinder end # rubocop: enable CodeReuse/ActiveRecord end + +GroupMembersFinder.prepend_if_ee('EE::GroupMembersFinder') diff --git a/app/finders/group_projects_finder.rb b/app/finders/group_projects_finder.rb index 5e0dbbfca2e..8ab5072fdc6 100644 --- a/app/finders/group_projects_finder.rb +++ b/app/finders/group_projects_finder.rb @@ -100,3 +100,5 @@ class GroupProjectsFinder < ProjectsFinder group.shared_projects end end + +GroupProjectsFinder.prepend_if_ee('EE::GroupProjectsFinder') diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index 58a01d598ba..74e89a1e66c 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -145,3 +145,5 @@ class IssuesFinder < IssuableFinder current_user.blank? end end + +IssuesFinder.prepend_if_ee('EE::IssuesFinder') diff --git a/app/finders/license_template_finder.rb b/app/finders/license_template_finder.rb index d735a4c1d69..1db175e1308 100644 --- a/app/finders/license_template_finder.rb +++ b/app/finders/license_template_finder.rb @@ -13,6 +13,8 @@ class LicenseTemplateFinder include Gitlab::Utils::StrongMemoize + prepend_if_ee('::EE::LicenseTemplateFinder') # rubocop: disable Cop/InjectEnterpriseEditionModule + attr_reader :project, :params def initialize(project, params = {}) diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 29947bc94d5..1c9c7ec68d0 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -101,3 +101,5 @@ class MergeRequestsFinder < IssuableFinder .or(table[:title].matches('[WIP]%')) end end + +MergeRequestsFinder.prepend_if_ee('EE::MergeRequestsFinder') diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index f7d9100bb78..e798db561bf 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -171,3 +171,5 @@ class NotesFinder @params[:notes_filter].present? end end + +NotesFinder.prepend_if_ee('EE::NotesFinder') diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index 23b731b1aed..df06e68c941 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -24,6 +24,8 @@ class ProjectsFinder < UnionFinder include CustomAttributesFilter + prepend_if_ee('::EE::ProjectsFinder') # rubocop: disable Cop/InjectEnterpriseEditionModule + attr_accessor :params attr_reader :current_user, :project_ids_relation diff --git a/app/finders/template_finder.rb b/app/finders/template_finder.rb index 3e483716064..dfea3d427c2 100644 --- a/app/finders/template_finder.rb +++ b/app/finders/template_finder.rb @@ -3,6 +3,8 @@ class TemplateFinder include Gitlab::Utils::StrongMemoize + prepend_if_ee('::EE::TemplateFinder') # rubocop: disable Cop/InjectEnterpriseEditionModule + VENDORED_TEMPLATES = HashWithIndifferentAccess.new( dockerfiles: ::Gitlab::Template::DockerfileTemplate, gitignores: ::Gitlab::Template::GitignoreTemplate, diff --git a/app/finders/users_finder.rb b/app/finders/users_finder.rb index 81ae50c0bd1..d5650c6828d 100644 --- a/app/finders/users_finder.rb +++ b/app/finders/users_finder.rb @@ -95,3 +95,5 @@ class UsersFinder end end end + +UsersFinder.prepend_if_ee('EE::UsersFinder') diff --git a/app/graphql/resolvers/echo_resolver.rb b/app/graphql/resolvers/echo_resolver.rb index 8076e1784ce..2ce55544254 100644 --- a/app/graphql/resolvers/echo_resolver.rb +++ b/app/graphql/resolvers/echo_resolver.rb @@ -2,7 +2,7 @@ module Resolvers class EchoResolver < BaseResolver - argument :text, GraphQL::STRING_TYPE, required: true + argument :text, GraphQL::STRING_TYPE, required: true # rubocop:disable Graphql/Descriptions description 'Testing endpoint to validate the API with' def resolve(**args) diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index dd104e83f43..b50186c5a82 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -33,9 +33,9 @@ module Resolvers argument :closed_after, Types::TimeType, required: false, description: "Issues closed after this date" - argument :search, GraphQL::STRING_TYPE, + argument :search, GraphQL::STRING_TYPE, # rubocop:disable Graphql/Descriptions required: false - argument :sort, Types::Sort, + argument :sort, Types::Sort, # rubocop:disable Graphql/Descriptions required: false, default_value: 'created_desc' diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index 5f7d7a934ce..d2847641d91 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -6,14 +6,14 @@ module Types class DetailedStatusType < BaseObject graphql_name 'DetailedStatus' - field :group, GraphQL::STRING_TYPE, null: false - field :icon, GraphQL::STRING_TYPE, null: false - field :favicon, GraphQL::STRING_TYPE, null: false - field :details_path, GraphQL::STRING_TYPE, null: false - field :has_details, GraphQL::BOOLEAN_TYPE, null: false, method: :has_details? - field :label, GraphQL::STRING_TYPE, null: false - field :text, GraphQL::STRING_TYPE, null: false - field :tooltip, GraphQL::STRING_TYPE, null: false, method: :status_tooltip + field :group, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :icon, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :favicon, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :details_path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :has_details, GraphQL::BOOLEAN_TYPE, null: false, method: :has_details? # rubocop:disable Graphql/Descriptions + field :label, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :text, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :tooltip, GraphQL::STRING_TYPE, null: false, method: :status_tooltip # rubocop:disable Graphql/Descriptions end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index cff81e5670b..dfcfd6211bc 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -9,13 +9,13 @@ module Types expose_permissions Types::PermissionTypes::Ci::Pipeline - field :id, GraphQL::ID_TYPE, null: false - field :iid, GraphQL::STRING_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :iid, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :sha, GraphQL::STRING_TYPE, null: false - field :before_sha, GraphQL::STRING_TYPE, null: true - field :status, PipelineStatusEnum, null: false - field :detailed_status, + field :sha, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :before_sha, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :status, PipelineStatusEnum, null: false # rubocop:disable Graphql/Descriptions + field :detailed_status, # rubocop:disable Graphql/Descriptions Types::Ci::DetailedStatusType, null: false, resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) } @@ -27,11 +27,11 @@ module Types GraphQL::FLOAT_TYPE, null: true, description: "Coverage percentage" - field :created_at, Types::TimeType, null: false - field :updated_at, Types::TimeType, null: false - field :started_at, Types::TimeType, null: true - field :finished_at, Types::TimeType, null: true - field :committed_at, Types::TimeType, null: true + field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :started_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions + field :finished_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions + field :committed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions # TODO: Add triggering user as a type end diff --git a/app/graphql/types/commit_type.rb b/app/graphql/types/commit_type.rb index d73dd73affd..dd2d81adb8b 100644 --- a/app/graphql/types/commit_type.rb +++ b/app/graphql/types/commit_type.rb @@ -8,16 +8,16 @@ module Types present_using CommitPresenter - field :id, type: GraphQL::ID_TYPE, null: false - field :sha, type: GraphQL::STRING_TYPE, null: false - field :title, type: GraphQL::STRING_TYPE, null: true - field :description, type: GraphQL::STRING_TYPE, null: true - field :message, type: GraphQL::STRING_TYPE, null: true - field :authored_date, type: Types::TimeType, null: true - field :web_url, type: GraphQL::STRING_TYPE, null: false + field :id, type: GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :sha, type: GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :title, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :description, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :message, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :authored_date, type: Types::TimeType, null: true # rubocop:disable Graphql/Descriptions + field :web_url, type: GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions # models/commit lazy loads the author by email - field :author, type: Types::UserType, null: true + field :author, type: Types::UserType, null: true # rubocop:disable Graphql/Descriptions field :latest_pipeline, type: Types::Ci::PipelineType, diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index 66b41919914..1e52c0cb147 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -8,14 +8,16 @@ module Types expose_permissions Types::PermissionTypes::Group - field :web_url, GraphQL::STRING_TYPE, null: false + field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :avatar_url, GraphQL::STRING_TYPE, null: true, resolve: -> (group, args, ctx) do + field :avatar_url, GraphQL::STRING_TYPE, null: true, resolve: -> (group, args, ctx) do # rubocop:disable Graphql/Descriptions group.avatar_url(only_path: false) end - field :parent, GroupType, + field :parent, GroupType, # rubocop:disable Graphql/Descriptions null: true, resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find } end end + +Types::GroupType.prepend_if_ee('EE::Types::GroupType') diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 8b208cab1df..09e51ae4bc0 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -12,48 +12,50 @@ module Types present_using IssuePresenter - field :iid, GraphQL::ID_TYPE, null: false - field :title, GraphQL::STRING_TYPE, null: false + field :iid, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions markdown_field :title_html, null: true - field :description, GraphQL::STRING_TYPE, null: true + field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions markdown_field :description_html, null: true - field :state, IssueStateEnum, null: false + field :state, IssueStateEnum, null: false # rubocop:disable Graphql/Descriptions - field :reference, GraphQL::STRING_TYPE, null: false, method: :to_reference do - argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false + field :reference, GraphQL::STRING_TYPE, null: false, method: :to_reference do # rubocop:disable Graphql/Descriptions + argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false # rubocop:disable Graphql/Descriptions end - field :author, Types::UserType, + field :author, Types::UserType, # rubocop:disable Graphql/Descriptions null: false, resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.author_id).find } # Remove complexity when BatchLoader is used - field :assignees, Types::UserType.connection_type, null: true, complexity: 5 + field :assignees, Types::UserType.connection_type, null: true, complexity: 5 # rubocop:disable Graphql/Descriptions # Remove complexity when BatchLoader is used - field :labels, Types::LabelType.connection_type, null: true, complexity: 5 - field :milestone, Types::MilestoneType, + field :labels, Types::LabelType.connection_type, null: true, complexity: 5 # rubocop:disable Graphql/Descriptions + field :milestone, Types::MilestoneType, # rubocop:disable Graphql/Descriptions null: true, resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find } - field :due_date, Types::TimeType, null: true - field :confidential, GraphQL::BOOLEAN_TYPE, null: false - field :discussion_locked, GraphQL::BOOLEAN_TYPE, + field :due_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions + field :confidential, GraphQL::BOOLEAN_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :discussion_locked, GraphQL::BOOLEAN_TYPE, # rubocop:disable Graphql/Descriptions null: false, resolve: -> (obj, _args, _ctx) { !!obj.discussion_locked } - field :upvotes, GraphQL::INT_TYPE, null: false - field :downvotes, GraphQL::INT_TYPE, null: false - field :user_notes_count, GraphQL::INT_TYPE, null: false - field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path - field :web_url, GraphQL::STRING_TYPE, null: false - field :relative_position, GraphQL::INT_TYPE, null: true + field :upvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :downvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :user_notes_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path # rubocop:disable Graphql/Descriptions + field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :relative_position, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :closed_at, Types::TimeType, null: true + field :closed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions - field :created_at, Types::TimeType, null: false - field :updated_at, Types::TimeType, null: false + field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions - field :task_completion_status, Types::TaskCompletionStatus, null: false + field :task_completion_status, Types::TaskCompletionStatus, null: false # rubocop:disable Graphql/Descriptions end end + +Types::IssueType.prepend_if_ee('::EE::Types::IssueType') diff --git a/app/graphql/types/label_type.rb b/app/graphql/types/label_type.rb index 3aeda2e7953..384a27df563 100644 --- a/app/graphql/types/label_type.rb +++ b/app/graphql/types/label_type.rb @@ -6,10 +6,10 @@ module Types authorize :read_label - field :description, GraphQL::STRING_TYPE, null: true + field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions markdown_field :description_html, null: true - field :title, GraphQL::STRING_TYPE, null: false - field :color, GraphQL::STRING_TYPE, null: false - field :text_color, GraphQL::STRING_TYPE, null: false + field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :color, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :text_color, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index b8f63a750c5..1baaa33c819 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -12,53 +12,55 @@ module Types present_using MergeRequestPresenter - field :id, GraphQL::ID_TYPE, null: false - field :iid, GraphQL::STRING_TYPE, null: false - field :title, GraphQL::STRING_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :iid, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions markdown_field :title_html, null: true - field :description, GraphQL::STRING_TYPE, null: true + field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions markdown_field :description_html, null: true - field :state, MergeRequestStateEnum, null: false - field :created_at, Types::TimeType, null: false - field :updated_at, Types::TimeType, null: false - field :source_project, Types::ProjectType, null: true - field :target_project, Types::ProjectType, null: false - field :diff_refs, Types::DiffRefsType, null: true + field :state, MergeRequestStateEnum, null: false # rubocop:disable Graphql/Descriptions + field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :source_project, Types::ProjectType, null: true # rubocop:disable Graphql/Descriptions + field :target_project, Types::ProjectType, null: false # rubocop:disable Graphql/Descriptions + field :diff_refs, Types::DiffRefsType, null: true # rubocop:disable Graphql/Descriptions # Alias for target_project - field :project, Types::ProjectType, null: false - field :project_id, GraphQL::INT_TYPE, null: false, method: :target_project_id - field :source_project_id, GraphQL::INT_TYPE, null: true - field :target_project_id, GraphQL::INT_TYPE, null: false - field :source_branch, GraphQL::STRING_TYPE, null: false - field :target_branch, GraphQL::STRING_TYPE, null: false - field :work_in_progress, GraphQL::BOOLEAN_TYPE, method: :work_in_progress?, null: false - field :merge_when_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true - field :diff_head_sha, GraphQL::STRING_TYPE, null: true - field :merge_commit_sha, GraphQL::STRING_TYPE, null: true - field :user_notes_count, GraphQL::INT_TYPE, null: true - field :should_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :should_remove_source_branch?, null: true - field :force_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :force_remove_source_branch?, null: true - field :merge_status, GraphQL::STRING_TYPE, null: true - field :in_progress_merge_commit_sha, GraphQL::STRING_TYPE, null: true - field :merge_error, GraphQL::STRING_TYPE, null: true - field :allow_collaboration, GraphQL::BOOLEAN_TYPE, null: true - field :should_be_rebased, GraphQL::BOOLEAN_TYPE, method: :should_be_rebased?, null: false - field :rebase_commit_sha, GraphQL::STRING_TYPE, null: true - field :rebase_in_progress, GraphQL::BOOLEAN_TYPE, method: :rebase_in_progress?, null: false, calls_gitaly: true + field :project, Types::ProjectType, null: false # rubocop:disable Graphql/Descriptions + field :project_id, GraphQL::INT_TYPE, null: false, method: :target_project_id # rubocop:disable Graphql/Descriptions + field :source_project_id, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :target_project_id, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :source_branch, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :target_branch, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :work_in_progress, GraphQL::BOOLEAN_TYPE, method: :work_in_progress?, null: false # rubocop:disable Graphql/Descriptions + field :merge_when_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :diff_head_sha, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :merge_commit_sha, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :user_notes_count, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :should_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :should_remove_source_branch?, null: true # rubocop:disable Graphql/Descriptions + field :force_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :force_remove_source_branch?, null: true # rubocop:disable Graphql/Descriptions + field :merge_status, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :in_progress_merge_commit_sha, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :merge_error, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :allow_collaboration, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :should_be_rebased, GraphQL::BOOLEAN_TYPE, method: :should_be_rebased?, null: false # rubocop:disable Graphql/Descriptions + field :rebase_commit_sha, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :rebase_in_progress, GraphQL::BOOLEAN_TYPE, method: :rebase_in_progress?, null: false, calls_gitaly: true # rubocop:disable Graphql/Descriptions + # rubocop:disable Graphql/Descriptions field :merge_commit_message, GraphQL::STRING_TYPE, method: :default_merge_commit_message, null: true, deprecation_reason: "Renamed to defaultMergeCommitMessage" - field :default_merge_commit_message, GraphQL::STRING_TYPE, null: true - field :merge_ongoing, GraphQL::BOOLEAN_TYPE, method: :merge_ongoing?, null: false - field :source_branch_exists, GraphQL::BOOLEAN_TYPE, method: :source_branch_exists?, null: false - field :mergeable_discussions_state, GraphQL::BOOLEAN_TYPE, null: true - field :web_url, GraphQL::STRING_TYPE, null: true - field :upvotes, GraphQL::INT_TYPE, null: false - field :downvotes, GraphQL::INT_TYPE, null: false - field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false + # rubocop:enable Graphql/Descriptions + field :default_merge_commit_message, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :merge_ongoing, GraphQL::BOOLEAN_TYPE, method: :merge_ongoing?, null: false # rubocop:disable Graphql/Descriptions + field :source_branch_exists, GraphQL::BOOLEAN_TYPE, method: :source_branch_exists?, null: false # rubocop:disable Graphql/Descriptions + field :mergeable_discussions_state, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :web_url, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :upvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :downvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false # rubocop:disable Graphql/Descriptions - field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline - field :pipelines, Types::Ci::PipelineType.connection_type, + field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline # rubocop:disable Graphql/Descriptions + field :pipelines, Types::Ci::PipelineType.connection_type, # rubocop:disable Graphql/Descriptions resolver: Resolvers::MergeRequestPipelinesResolver - field :task_completion_status, Types::TaskCompletionStatus, null: false + field :task_completion_status, Types::TaskCompletionStatus, null: false # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/metadata_type.rb b/app/graphql/types/metadata_type.rb index 7d7813a7652..bfcb929f5ac 100644 --- a/app/graphql/types/metadata_type.rb +++ b/app/graphql/types/metadata_type.rb @@ -6,7 +6,7 @@ module Types authorize :read_instance_metadata - field :version, GraphQL::STRING_TYPE, null: false - field :revision, GraphQL::STRING_TYPE, null: false + field :version, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :revision, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/milestone_type.rb b/app/graphql/types/milestone_type.rb index 2772fbec86f..78d0a8220ec 100644 --- a/app/graphql/types/milestone_type.rb +++ b/app/graphql/types/milestone_type.rb @@ -6,14 +6,14 @@ module Types authorize :read_milestone - field :description, GraphQL::STRING_TYPE, null: true - field :title, GraphQL::STRING_TYPE, null: false - field :state, GraphQL::STRING_TYPE, null: false + field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :state, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :due_date, Types::TimeType, null: true - field :start_date, Types::TimeType, null: true + field :due_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions + field :start_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions - field :created_at, Types::TimeType, null: false - field :updated_at, Types::TimeType, null: false + field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index f843d6ad86f..17f922a5e54 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -17,3 +17,5 @@ module Types mount_mutation Mutations::Notes::Destroy end end + +::Types::MutationType.prepend_if_ee('::EE::Types::MutationType') diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index 35a97b5ace0..cc1d06b19e1 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -6,25 +6,25 @@ module Types authorize :read_namespace - field :id, GraphQL::ID_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :name, GraphQL::STRING_TYPE, null: false - field :path, GraphQL::STRING_TYPE, null: false - field :full_name, GraphQL::STRING_TYPE, null: false - field :full_path, GraphQL::ID_TYPE, null: false + field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :full_name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :full_path, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :description, GraphQL::STRING_TYPE, null: true + field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions markdown_field :description_html, null: true - field :visibility, GraphQL::STRING_TYPE, null: true - field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled? - field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true + field :visibility, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled? # rubocop:disable Graphql/Descriptions + field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions field :root_storage_statistics, Types::RootStorageStatisticsType, null: true, description: 'The aggregated storage statistics. Only available for root namespaces', resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find } - field :projects, + field :projects, # rubocop:disable Graphql/Descriptions Types::ProjectType.connection_type, null: false, resolver: ::Resolvers::NamespaceProjectsResolver diff --git a/app/graphql/types/notes/diff_position_type.rb b/app/graphql/types/notes/diff_position_type.rb index 6a0377fbfdf..cab8c750dc0 100644 --- a/app/graphql/types/notes/diff_position_type.rb +++ b/app/graphql/types/notes/diff_position_type.rb @@ -7,7 +7,7 @@ module Types class DiffPositionType < BaseObject graphql_name 'DiffPosition' - field :diff_refs, Types::DiffRefsType, null: false + field :diff_refs, Types::DiffRefsType, null: false # rubocop:disable Graphql/Descriptions field :file_path, GraphQL::STRING_TYPE, null: false, description: "The path of the file that was changed" @@ -15,7 +15,7 @@ module Types description: "The path of the file on the start sha." field :new_path, GraphQL::STRING_TYPE, null: true, description: "The path of the file on the head sha." - field :position_type, Types::Notes::PositionTypeEnum, null: false + field :position_type, Types::Notes::PositionTypeEnum, null: false # rubocop:disable Graphql/Descriptions # Fields for text positions field :old_line, GraphQL::INT_TYPE, null: true, diff --git a/app/graphql/types/notes/discussion_type.rb b/app/graphql/types/notes/discussion_type.rb index a3fb28298f6..ab87f8280ac 100644 --- a/app/graphql/types/notes/discussion_type.rb +++ b/app/graphql/types/notes/discussion_type.rb @@ -7,9 +7,9 @@ module Types authorize :read_note - field :id, GraphQL::ID_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions field :reply_id, GraphQL::ID_TYPE, null: false, description: 'The ID used to reply to this discussion' - field :created_at, Types::TimeType, null: false + field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions field :notes, Types::Notes::NoteType.connection_type, null: false, description: "All notes in the discussion" # The gem we use to generate Global IDs is hard-coded to work with diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index fe54a45c7dc..4edf6ed90f7 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -9,7 +9,7 @@ module Types expose_permissions Types::PermissionTypes::Note - field :id, GraphQL::ID_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions field :project, Types::ProjectType, null: true, @@ -37,10 +37,10 @@ module Types markdown_field :body_html, null: true, method: :note - field :created_at, Types::TimeType, null: false - field :updated_at, Types::TimeType, null: false + field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions + field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions field :discussion, Types::Notes::DiscussionType, null: true, description: "The discussion this note is a part of" - field :resolvable, GraphQL::BOOLEAN_TYPE, null: false, method: :resolvable? + field :resolvable, GraphQL::BOOLEAN_TYPE, null: false, method: :resolvable? # rubocop:disable Graphql/Descriptions field :resolved_at, Types::TimeType, null: true, description: "The time the discussion was resolved" field :position, Types::Notes::DiffPositionType, null: true, description: "The position of this note on a diff" end diff --git a/app/graphql/types/notes/noteable_type.rb b/app/graphql/types/notes/noteable_type.rb index 9f126d67b0d..ab4a170b123 100644 --- a/app/graphql/types/notes/noteable_type.rb +++ b/app/graphql/types/notes/noteable_type.rb @@ -23,3 +23,5 @@ module Types end end end + +Types::Notes::NoteableType.extend_if_ee('::EE::Types::Notes::NoteableType') diff --git a/app/graphql/types/permission_types/base_permission_type.rb b/app/graphql/types/permission_types/base_permission_type.rb index 26a71e2bfbb..73049ebed7b 100644 --- a/app/graphql/types/permission_types/base_permission_type.rb +++ b/app/graphql/types/permission_types/base_permission_type.rb @@ -28,7 +28,7 @@ module Types description: "Whether or not a user can perform `#{name}` on this resource", null: false) - field(**kword_args) + field(**kword_args) # rubocop:disable Graphql/Descriptions end def self.resolving_keywords?(arguments) diff --git a/app/graphql/types/permission_types/issue.rb b/app/graphql/types/permission_types/issue.rb index 199540c7d6d..e26c5950e73 100644 --- a/app/graphql/types/permission_types/issue.rb +++ b/app/graphql/types/permission_types/issue.rb @@ -12,3 +12,5 @@ module Types end end end + +Types::PermissionTypes::Issue.prepend_if_ee('::EE::Types::PermissionTypes::Issue') diff --git a/app/graphql/types/permission_types/project.rb b/app/graphql/types/permission_types/project.rb index 993d33c4fc2..3a6ba371154 100644 --- a/app/graphql/types/permission_types/project.rb +++ b/app/graphql/types/permission_types/project.rb @@ -20,3 +20,5 @@ module Types end end end + +Types::PermissionTypes::Project.prepend_if_ee('EE::Types::PermissionTypes::Project') diff --git a/app/graphql/types/project_statistics_type.rb b/app/graphql/types/project_statistics_type.rb index 4000c6db280..5045471a75b 100644 --- a/app/graphql/types/project_statistics_type.rb +++ b/app/graphql/types/project_statistics_type.rb @@ -6,13 +6,13 @@ module Types authorize :read_statistics - field :commit_count, GraphQL::INT_TYPE, null: false + field :commit_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :storage_size, GraphQL::INT_TYPE, null: false - field :repository_size, GraphQL::INT_TYPE, null: false - field :lfs_objects_size, GraphQL::INT_TYPE, null: false - field :build_artifacts_size, GraphQL::INT_TYPE, null: false - field :packages_size, GraphQL::INT_TYPE, null: false - field :wiki_size, GraphQL::INT_TYPE, null: true + field :storage_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :repository_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :lfs_objects_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :build_artifacts_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :packages_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :wiki_size, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 13be71c26ee..7184cf42284 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -8,95 +8,95 @@ module Types expose_permissions Types::PermissionTypes::Project - field :id, GraphQL::ID_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :full_path, GraphQL::ID_TYPE, null: false - field :path, GraphQL::STRING_TYPE, null: false + field :full_path, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :name_with_namespace, GraphQL::STRING_TYPE, null: false - field :name, GraphQL::STRING_TYPE, null: false + field :name_with_namespace, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :description, GraphQL::STRING_TYPE, null: true + field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions markdown_field :description_html, null: true - field :tag_list, GraphQL::STRING_TYPE, null: true + field :tag_list, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :ssh_url_to_repo, GraphQL::STRING_TYPE, null: true - field :http_url_to_repo, GraphQL::STRING_TYPE, null: true - field :web_url, GraphQL::STRING_TYPE, null: true + field :ssh_url_to_repo, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :http_url_to_repo, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :web_url, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :star_count, GraphQL::INT_TYPE, null: false - field :forks_count, GraphQL::INT_TYPE, null: false, calls_gitaly: true # 4 times + field :star_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :forks_count, GraphQL::INT_TYPE, null: false, calls_gitaly: true # 4 times # rubocop:disable Graphql/Descriptions - field :created_at, Types::TimeType, null: true - field :last_activity_at, Types::TimeType, null: true + field :created_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions + field :last_activity_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions - field :archived, GraphQL::BOOLEAN_TYPE, null: true + field :archived, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :visibility, GraphQL::STRING_TYPE, null: true + field :visibility, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :container_registry_enabled, GraphQL::BOOLEAN_TYPE, null: true - field :shared_runners_enabled, GraphQL::BOOLEAN_TYPE, null: true - field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true - field :merge_requests_ff_only_enabled, GraphQL::BOOLEAN_TYPE, null: true + field :container_registry_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :shared_runners_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :merge_requests_ff_only_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :avatar_url, GraphQL::STRING_TYPE, null: true, calls_gitaly: true, resolve: -> (project, args, ctx) do + field :avatar_url, GraphQL::STRING_TYPE, null: true, calls_gitaly: true, resolve: -> (project, args, ctx) do # rubocop:disable Graphql/Descriptions project.avatar_url(only_path: false) end %i[issues merge_requests wiki snippets].each do |feature| - field "#{feature}_enabled", GraphQL::BOOLEAN_TYPE, null: true, resolve: -> (project, args, ctx) do + field "#{feature}_enabled", GraphQL::BOOLEAN_TYPE, null: true, resolve: -> (project, args, ctx) do # rubocop:disable Graphql/Descriptions project.feature_available?(feature, ctx[:current_user]) end end - field :jobs_enabled, GraphQL::BOOLEAN_TYPE, null: true, resolve: -> (project, args, ctx) do + field :jobs_enabled, GraphQL::BOOLEAN_TYPE, null: true, resolve: -> (project, args, ctx) do # rubocop:disable Graphql/Descriptions project.feature_available?(:builds, ctx[:current_user]) end - field :public_jobs, GraphQL::BOOLEAN_TYPE, method: :public_builds, null: true + field :public_jobs, GraphQL::BOOLEAN_TYPE, method: :public_builds, null: true # rubocop:disable Graphql/Descriptions - field :open_issues_count, GraphQL::INT_TYPE, null: true, resolve: -> (project, args, ctx) do + field :open_issues_count, GraphQL::INT_TYPE, null: true, resolve: -> (project, args, ctx) do # rubocop:disable Graphql/Descriptions project.open_issues_count if project.feature_available?(:issues, ctx[:current_user]) end - field :import_status, GraphQL::STRING_TYPE, null: true + field :import_status, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :only_allow_merge_if_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true - field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true - field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::BOOLEAN_TYPE, null: true - field :printing_merge_request_link_enabled, GraphQL::BOOLEAN_TYPE, null: true + field :only_allow_merge_if_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :printing_merge_request_link_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions - field :namespace, Types::NamespaceType, null: true - field :group, Types::GroupType, null: true + field :namespace, Types::NamespaceType, null: true # rubocop:disable Graphql/Descriptions + field :group, Types::GroupType, null: true # rubocop:disable Graphql/Descriptions - field :statistics, Types::ProjectStatisticsType, + field :statistics, Types::ProjectStatisticsType, # rubocop:disable Graphql/Descriptions null: true, resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchProjectStatisticsLoader.new(obj.id).find } - field :repository, Types::RepositoryType, null: true + field :repository, Types::RepositoryType, null: true # rubocop:disable Graphql/Descriptions - field :merge_requests, + field :merge_requests, # rubocop:disable Graphql/Descriptions Types::MergeRequestType.connection_type, null: true, resolver: Resolvers::MergeRequestsResolver - field :merge_request, + field :merge_request, # rubocop:disable Graphql/Descriptions Types::MergeRequestType, null: true, resolver: Resolvers::MergeRequestsResolver.single - field :issues, + field :issues, # rubocop:disable Graphql/Descriptions Types::IssueType.connection_type, null: true, resolver: Resolvers::IssuesResolver - field :issue, + field :issue, # rubocop:disable Graphql/Descriptions Types::IssueType, null: true, resolver: Resolvers::IssuesResolver.single - field :pipelines, + field :pipelines, # rubocop:disable Graphql/Descriptions Types::Ci::PipelineType.connection_type, null: true, resolver: Resolvers::ProjectPipelinesResolver diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index c686300b25d..bbf94fb92df 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -24,6 +24,6 @@ module Types resolver: Resolvers::MetadataResolver, description: 'Metadata about GitLab' - field :echo, GraphQL::STRING_TYPE, null: false, resolver: Resolvers::EchoResolver + field :echo, GraphQL::STRING_TYPE, null: false, resolver: Resolvers::EchoResolver # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/repository_type.rb b/app/graphql/types/repository_type.rb index b024eca61fc..9ecd336b41d 100644 --- a/app/graphql/types/repository_type.rb +++ b/app/graphql/types/repository_type.rb @@ -6,9 +6,9 @@ module Types authorize :download_code - field :root_ref, GraphQL::STRING_TYPE, null: true, calls_gitaly: true - field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?, calls_gitaly: true - field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists? - field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true + field :root_ref, GraphQL::STRING_TYPE, null: true, calls_gitaly: true # rubocop:disable Graphql/Descriptions + field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?, calls_gitaly: true # rubocop:disable Graphql/Descriptions + field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists? # rubocop:disable Graphql/Descriptions + field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true # rubocop:disable Graphql/Descriptions end end diff --git a/app/graphql/types/task_completion_status.rb b/app/graphql/types/task_completion_status.rb index ac128481ac4..0aa8fc60a7c 100644 --- a/app/graphql/types/task_completion_status.rb +++ b/app/graphql/types/task_completion_status.rb @@ -8,8 +8,8 @@ module Types graphql_name 'TaskCompletionStatus' description 'Completion status of tasks' - field :count, GraphQL::INT_TYPE, null: false - field :completed_count, GraphQL::INT_TYPE, null: false + field :count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :completed_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb index 9497e378dc0..0886a0ba98e 100644 --- a/app/graphql/types/tree/blob_type.rb +++ b/app/graphql/types/tree/blob_type.rb @@ -10,8 +10,8 @@ module Types graphql_name 'Blob' - field :web_url, GraphQL::STRING_TYPE, null: true - field :lfs_oid, GraphQL::STRING_TYPE, null: true, resolve: -> (blob, args, ctx) do + field :web_url, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :lfs_oid, GraphQL::STRING_TYPE, null: true, resolve: -> (blob, args, ctx) do # rubocop:disable Graphql/Descriptions Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(blob.repository, blob.id).find end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/tree/entry_type.rb b/app/graphql/types/tree/entry_type.rb index d8e8642ddb8..10c2ad8815e 100644 --- a/app/graphql/types/tree/entry_type.rb +++ b/app/graphql/types/tree/entry_type.rb @@ -4,11 +4,11 @@ module Types module EntryType include Types::BaseInterface - field :id, GraphQL::ID_TYPE, null: false - field :name, GraphQL::STRING_TYPE, null: false - field :type, Tree::TypeEnum, null: false - field :path, GraphQL::STRING_TYPE, null: false - field :flat_path, GraphQL::STRING_TYPE, null: false + field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :type, Tree::TypeEnum, null: false # rubocop:disable Graphql/Descriptions + field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :flat_path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions end end end diff --git a/app/graphql/types/tree/submodule_type.rb b/app/graphql/types/tree/submodule_type.rb index 2b47e5c0161..d8e2ab4dd68 100644 --- a/app/graphql/types/tree/submodule_type.rb +++ b/app/graphql/types/tree/submodule_type.rb @@ -8,8 +8,8 @@ module Types graphql_name 'Submodule' - field :web_url, type: GraphQL::STRING_TYPE, null: true - field :tree_url, type: GraphQL::STRING_TYPE, null: true + field :web_url, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :tree_url, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/tree/tree_entry_type.rb b/app/graphql/types/tree/tree_entry_type.rb index d7faa633706..904c7dfb795 100644 --- a/app/graphql/types/tree/tree_entry_type.rb +++ b/app/graphql/types/tree/tree_entry_type.rb @@ -11,7 +11,7 @@ module Types graphql_name 'TreeEntry' description 'Represents a directory' - field :web_url, GraphQL::STRING_TYPE, null: true + field :web_url, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/tree/tree_type.rb b/app/graphql/types/tree/tree_type.rb index 99f2a6c0235..b967cf3a247 100644 --- a/app/graphql/types/tree/tree_type.rb +++ b/app/graphql/types/tree/tree_type.rb @@ -7,19 +7,21 @@ module Types graphql_name 'Tree' # Complexity 10 as it triggers a Gitaly call on each render - field :last_commit, Types::CommitType, null: true, complexity: 10, calls_gitaly: true, resolve: -> (tree, args, ctx) do + field :last_commit, Types::CommitType, null: true, complexity: 10, calls_gitaly: true, resolve: -> (tree, args, ctx) do # rubocop:disable Graphql/Descriptions tree.repository.last_commit_for_path(tree.sha, tree.path) end - field :trees, Types::Tree::TreeEntryType.connection_type, null: false, resolve: -> (obj, args, ctx) do + field :trees, Types::Tree::TreeEntryType.connection_type, null: false, resolve: -> (obj, args, ctx) do # rubocop:disable Graphql/Descriptions Gitlab::Graphql::Representation::TreeEntry.decorate(obj.trees, obj.repository) end + # rubocop:disable Graphql/Descriptions field :submodules, Types::Tree::SubmoduleType.connection_type, null: false, calls_gitaly: true, resolve: -> (obj, args, ctx) do Gitlab::Graphql::Representation::SubmoduleTreeEntry.decorate(obj.submodules, obj) end + # rubocop:enable Graphql/Descriptions - field :blobs, Types::Tree::BlobType.connection_type, null: false, calls_gitaly: true, resolve: -> (obj, args, ctx) do + field :blobs, Types::Tree::BlobType.connection_type, null: false, calls_gitaly: true, resolve: -> (obj, args, ctx) do # rubocop:disable Graphql/Descriptions Gitlab::Graphql::Representation::TreeEntry.decorate(obj.blobs, obj.repository) end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/user_type.rb b/app/graphql/types/user_type.rb index 6b53554314b..9f7d2a171d6 100644 --- a/app/graphql/types/user_type.rb +++ b/app/graphql/types/user_type.rb @@ -8,9 +8,9 @@ module Types present_using UserPresenter - field :name, GraphQL::STRING_TYPE, null: false - field :username, GraphQL::STRING_TYPE, null: false - field :avatar_url, GraphQL::STRING_TYPE, null: false - field :web_url, GraphQL::STRING_TYPE, null: false + field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :username, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :avatar_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions end end diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb index 6b43d52c775..0c1b2c7d093 100644 --- a/app/helpers/appearances_helper.rb +++ b/app/helpers/appearances_helper.rb @@ -78,3 +78,5 @@ module AppearancesHelper style.join end end + +AppearancesHelper.prepend_if_ee('EE::AppearancesHelper') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1671aa5bd04..5c2420e80f2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -325,3 +325,5 @@ module ApplicationHelper ::Appearance.current end end + +ApplicationHelper.prepend_if_ee('EE::ApplicationHelper') diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 93e282e44be..9a1a2b3a79c 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -309,3 +309,9 @@ module ApplicationSettingsHelper can?(current_user, :read_cluster, Clusters::Instance.new) end end + +ApplicationSettingsHelper.prepend_if_ee('EE::ApplicationSettingsHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + +# The methods in `EE::ApplicationSettingsHelper` should be available as both +# instance and class methods. +ApplicationSettingsHelper.extend_if_ee('EE::ApplicationSettingsHelper') diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 31c4b27273b..9e6fcf6a267 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -110,3 +110,9 @@ module AuthHelper extend self end + +AuthHelper.prepend_if_ee('EE::AuthHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + +# The methods added in EE should be available as both class and instance +# methods, just like the methods provided by `AuthHelper` itself. +AuthHelper.extend_if_ee('EE::AuthHelper') diff --git a/app/helpers/award_emoji_helper.rb b/app/helpers/award_emoji_helper.rb index b97a95629f7..4bc5a7b090e 100644 --- a/app/helpers/award_emoji_helper.rb +++ b/app/helpers/award_emoji_helper.rb @@ -16,3 +16,5 @@ module AwardEmojiHelper end end end + +AwardEmojiHelper.prepend_if_ee('EE::AwardEmojiHelper') diff --git a/app/helpers/boards_helper.rb b/app/helpers/boards_helper.rb index 8ef3ed9e8a5..d3950219f3f 100644 --- a/app/helpers/boards_helper.rb +++ b/app/helpers/boards_helper.rb @@ -107,3 +107,5 @@ module BoardsHelper serializer.represent(board).as_json end end + +BoardsHelper.prepend_if_ee('EE::BoardsHelper') diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb index c759882d7f8..60c19e6fecd 100644 --- a/app/helpers/branches_helper.rb +++ b/app/helpers/branches_helper.rb @@ -9,3 +9,5 @@ module BranchesHelper ProtectedBranch.protected?(project, branch.name) end end + +BranchesHelper.prepend_if_ee('EE::BranchesHelper') diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb index 03adbfa204f..12cd5403f71 100644 --- a/app/helpers/button_helper.rb +++ b/app/helpers/button_helper.rb @@ -97,3 +97,5 @@ module ButtonHelper data: (data if data) end end + +ButtonHelper.prepend_if_ee('EE::ButtonHelper') diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb index 769f75f57c4..7ca509873cc 100644 --- a/app/helpers/clusters_helper.rb +++ b/app/helpers/clusters_helper.rb @@ -21,3 +21,5 @@ module ClustersHelper !cluster.provider.legacy_abac? end end + +ClustersHelper.prepend_if_ee('EE::ClustersHelper') diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index d71af08a656..518cb7c9714 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -52,3 +52,5 @@ module DashboardHelper links end end + +DashboardHelper.prepend_if_ee('EE::DashboardHelper') diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb index 23596769738..ee4991c0b53 100644 --- a/app/helpers/emails_helper.rb +++ b/app/helpers/emails_helper.rb @@ -191,3 +191,5 @@ module EmailsHelper current_appearance&.email_header_and_footer_enabled? end end + +EmailsHelper.prepend_if_ee('EE::EmailsHelper') diff --git a/app/helpers/environments_helper.rb b/app/helpers/environments_helper.rb index 0f118c235d8..c642a64ad61 100644 --- a/app/helpers/environments_helper.rb +++ b/app/helpers/environments_helper.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module EnvironmentsHelper + prepend_if_ee('::EE::EnvironmentsHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + def environments_list_data { endpoint: project_environments_path(@project, format: :json) diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index f7c7f37cc38..bdb0a881b08 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module FormHelper + prepend_if_ee('::EE::FormHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + def form_errors(model, type: 'form') return unless model.errors.any? diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index 04cf43be452..f524696cc2f 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -194,3 +194,5 @@ module GitlabRoutingHelper take_ownership_project_pipeline_schedule_path(project, schedule, *args) end end + +GitlabRoutingHelper.include_if_ee('EE::GitlabRoutingHelper') diff --git a/app/helpers/groups/group_members_helper.rb b/app/helpers/groups/group_members_helper.rb index a5d2f76820f..a8f6c974bbd 100644 --- a/app/helpers/groups/group_members_helper.rb +++ b/app/helpers/groups/group_members_helper.rb @@ -2,6 +2,8 @@ module Groups::GroupMembersHelper def group_member_select_options - { multiple: true, class: 'input-clamp', scope: :all, email_user: true } + { multiple: true, class: 'input-clamp qa-member-select-field ', scope: :all, email_user: true } end end + +Groups::GroupMembersHelper.prepend_if_ee('EE::Groups::GroupMembersHelper') diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index bd26bd01313..601560cca92 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -202,3 +202,5 @@ module GroupsHelper s_("GroupSettings|This setting is applied on %{ancestor_group} and has been overridden on this subgroup.").html_safe % { ancestor_group: ancestor_group(group) } end end + +GroupsHelper.prepend_if_ee('EE::GroupsHelper') diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index b88b25eb845..014523b54cb 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -447,3 +447,5 @@ module IssuablesHelper @project || @group end end + +IssuablesHelper.prepend_if_ee('EE::IssuablesHelper') diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 5476a7cdff6..d11b0594632 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -150,8 +150,28 @@ module IssuesHelper can?(current_user, :create_merge_request_in, @project) end + def issue_closed_link(issue, current_user, css_class: '') + if issue.moved? && can?(current_user, :read_issue, issue.moved_to) + link_to(s_('IssuableStatus|moved'), issue.moved_to, class: css_class) + elsif issue.duplicated? && can?(current_user, :read_issue, issue.duplicated_to) + link_to(s_('IssuableStatus|duplicated'), issue.duplicated_to, class: css_class) + end + end + + def issue_closed_text(issue, current_user) + link = issue_closed_link(issue, current_user, css_class: 'text-white text-underline') + + if link + s_('IssuableStatus|Closed (%{link})').html_safe % { link: link } + else + s_('IssuableStatus|Closed') + end + end + # Required for Banzai::Filter::IssueReferenceFilter module_function :url_for_issue module_function :url_for_internal_issue module_function :url_for_tracker_issue end + +IssuesHelper.include_if_ee('EE::IssuesHelper') diff --git a/app/helpers/kerberos_spnego_helper.rb b/app/helpers/kerberos_spnego_helper.rb index c0eb8f83f56..ed09ed755fe 100644 --- a/app/helpers/kerberos_spnego_helper.rb +++ b/app/helpers/kerberos_spnego_helper.rb @@ -9,3 +9,5 @@ module KerberosSpnegoHelper false # different behavior in GitLab Enterprise Edition end end + +KerberosSpnegoHelper.prepend_if_ee('EE::KerberosSpnegoHelper') diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index c5a3507637e..3a872622e73 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -251,3 +251,5 @@ module LabelsHelper # Required for Banzai::Filter::LabelReferenceFilter module_function :render_colored_label, :text_color_for_bg, :escape_once, :label_tooltip_title end + +LabelsHelper.prepend_if_ee('EE::LabelsHelper') diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 2de4e92e33e..b8f6458b499 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -159,3 +159,5 @@ module MergeRequestsHelper end end end + +MergeRequestsHelper.prepend_if_ee('EE::MergeRequestsHelper') diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index c1a04640688..e769734f27b 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -259,3 +259,5 @@ module MilestonesHelper end end end + +MilestonesHelper.prepend_if_ee('EE::MilestonesHelper') diff --git a/app/helpers/mirror_helper.rb b/app/helpers/mirror_helper.rb index 921c79ab771..6f6cb91e696 100644 --- a/app/helpers/mirror_helper.rb +++ b/app/helpers/mirror_helper.rb @@ -12,3 +12,5 @@ module MirrorHelper _('The Git LFS objects will <strong>not</strong> be synced.').html_safe end end + +MirrorHelper.prepend_if_ee('EE::MirrorHelper') diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 572d68cb4a3..9de28fb3ed9 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -88,3 +88,5 @@ module NamespacesHelper [group_label.camelize, elements] end end + +NamespacesHelper.include_if_ee('EE::NamespacesHelper') diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index a57ba5f3a4f..6aa910e6c3f 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -90,3 +90,5 @@ module NavHelper links end end + +NavHelper.prepend_if_ee('EE::NavHelper') diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index 4e88b379e16..fbbdebaa623 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -188,3 +188,5 @@ module NotesHelper rendered_for_merge_request? || params['html'].nil? end end + +NotesHelper.prepend_if_ee('EE::NotesHelper') diff --git a/app/helpers/onboarding_experiment_helper.rb b/app/helpers/onboarding_experiment_helper.rb index ad49d333d7a..138fc60479d 100644 --- a/app/helpers/onboarding_experiment_helper.rb +++ b/app/helpers/onboarding_experiment_helper.rb @@ -2,6 +2,8 @@ module OnboardingExperimentHelper def allow_access_to_onboarding? - ::Gitlab.com? && Feature.enabled?(:user_onboarding) + ::Gitlab.dev_env_or_com? && Feature.enabled?(:user_onboarding) end end + +OnboardingExperimentHelper.prepend_if_ee('EE::OnboardingExperimentHelper') diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 3672d8b1b03..6a271e93cd9 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -87,3 +87,5 @@ module PreferencesHelper first_day_of_week_choices.rassoc(Gitlab::CurrentSettings.first_day_of_week).first end end + +PreferencesHelper.prepend_if_ee('EE::PreferencesHelper') diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 14f947a03a3..3fb39a19cf0 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module ProjectsHelper + prepend_if_ee('::EE::ProjectsHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + def link_to_project(project) link_to namespace_project_path(namespace_id: project.namespace, id: project), title: h(project.name) do title = content_tag(:span, project.name, class: 'project-name') diff --git a/app/helpers/recaptcha_experiment_helper.rb b/app/helpers/recaptcha_experiment_helper.rb index d2eb9ac54f6..f15e92c0e99 100644 --- a/app/helpers/recaptcha_experiment_helper.rb +++ b/app/helpers/recaptcha_experiment_helper.rb @@ -5,3 +5,5 @@ module RecaptchaExperimentHelper !!Gitlab::Recaptcha.enabled? end end + +RecaptchaExperimentHelper.prepend_if_ee('EE::RecaptchaExperimentHelper') diff --git a/app/helpers/runners_helper.rb b/app/helpers/runners_helper.rb index 0d880c38a7b..d7a509e2bd3 100644 --- a/app/helpers/runners_helper.rb +++ b/app/helpers/runners_helper.rb @@ -39,3 +39,5 @@ module RunnersHelper end end end + +RunnersHelper.prepend_if_ee('EE::RunnersHelper') diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 2e2d324ab62..0f4e5adca6c 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -271,3 +271,5 @@ module SearchHelper end end end + +SearchHelper.prepend_if_ee('EE::SearchHelper') diff --git a/app/helpers/selects_helper.rb b/app/helpers/selects_helper.rb index 2f802e4eab8..90c54123597 100644 --- a/app/helpers/selects_helper.rb +++ b/app/helpers/selects_helper.rb @@ -89,3 +89,5 @@ module SelectsHelper } end end + +SelectsHelper.prepend_if_ee('EE::SelectsHelper') diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb index d4b50b7ecfb..ea7c7af72d3 100644 --- a/app/helpers/services_helper.rb +++ b/app/helpers/services_helper.rb @@ -44,3 +44,9 @@ module ServicesHelper extend self end + +ServicesHelper.prepend_if_ee('EE::ServicesHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + +# The methods in `EE::ServicesHelper` should be available as both instance and +# class methods. +ServicesHelper.extend_if_ee('EE::ServicesHelper') diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index a4eb76a2359..d680e10525d 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module SortingHelper + prepend_if_ee('::EE::SortingHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + def sort_options_hash { sort_value_created_date => sort_title_created_date, diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb index 3efae0a653c..51cbe93513d 100644 --- a/app/helpers/system_note_helper.rb +++ b/app/helpers/system_note_helper.rb @@ -39,3 +39,9 @@ module SystemNoteHelper extend self end + +SystemNoteHelper.prepend_if_ee('EE::SystemNoteHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule + +# The methods in `EE::SystemNoteHelper` should be available as both instance and +# class methods. +SystemNoteHelper.extend_if_ee('EE::SystemNoteHelper') diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index d91f0f78db7..53739cb63e3 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -134,3 +134,5 @@ module TabHelper 'active' if current_controller?('oauth/applications') end end + +TabHelper.prepend_if_ee('EE::TabHelper') diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index f5333bb332e..a919c068c42 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -204,3 +204,5 @@ module TodosHelper groups.unshift({ id: '', text: 'Any Group' }).to_json end end + +TodosHelper.prepend_if_ee('EE::NotesHelper'); TodosHelper.prepend_if_ee('EE::TodosHelper') # rubocop: disable Style/Semicolon diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index bb1cdcb1b31..afa057421e0 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -187,3 +187,5 @@ module TreeHelper attrs end end + +TreeHelper.prepend_if_ee('::EE::TreeHelper') diff --git a/app/helpers/user_callouts_helper.rb b/app/helpers/user_callouts_helper.rb index f10fadfdf49..cae3ec5f8d0 100644 --- a/app/helpers/user_callouts_helper.rb +++ b/app/helpers/user_callouts_helper.rb @@ -31,3 +31,5 @@ module UserCalloutsHelper current_user&.callouts&.find_by(feature_name: UserCallout.feature_names[feature_name]) end end + +UserCalloutsHelper.prepend_if_ee('EE::UserCalloutsHelper') diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index e38e3378e07..4ff25d021fb 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -109,3 +109,5 @@ module UsersHelper items end end + +UsersHelper.prepend_if_ee('EE::UsersHelper') diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb index 5e519cf5c19..9e1204738c1 100644 --- a/app/helpers/version_check_helper.rb +++ b/app/helpers/version_check_helper.rb @@ -22,3 +22,5 @@ module VersionCheckHelper 'gitlab-ce' end end + +VersionCheckHelper.prepend_if_ee('EE::VersionCheckHelper') diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index 864f9e2975a..d972d0dea28 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -117,3 +117,5 @@ module Emails end end end + +Emails::MergeRequests.prepend_if_ee('EE::Emails::MergeRequests') diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 8b93ead0ee6..c9a31b22207 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -69,3 +69,5 @@ module Emails end end end + +Emails::Notes.prepend_if_ee('EE::Emails::Notes') diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index f81f76f67f7..4acf4a1dc4f 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -57,3 +57,5 @@ module Emails end end end + +Emails::Projects.prepend_if_ee('EE::Emails::Projects') diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 3683f2ea9a9..6fa1c701cd8 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -228,3 +228,5 @@ class Notify < BaseMailer @unsubscribe_url = unsubscribe_sent_notification_url(@sent_notification) end end + +Notify.prepend_if_ee('EE::Notify') diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb index b3fab930922..3d42423ba46 100644 --- a/app/mailers/previews/notify_preview.rb +++ b/app/mailers/previews/notify_preview.rb @@ -210,3 +210,5 @@ class NotifyPreview < ActionMailer::Preview email end end + +NotifyPreview.prepend_if_ee('EE::Preview::NotifyPreview') diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index c9cd0140ed8..92526def144 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -315,3 +315,5 @@ class ApplicationSetting < ApplicationRecord recaptcha_enabled || login_recaptcha_protection_enabled end end + +ApplicationSetting.prepend_if_ee('EE::ApplicationSetting') diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 6ef2914ac11..c2eef500fb0 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -19,3 +19,5 @@ class AuditEvent < ApplicationRecord self.user.name end end + +AuditEvent.prepend_if_ee('EE::AuditEvent') diff --git a/app/models/blob.rb b/app/models/blob.rb index d528bef8b19..a590536d5fe 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -243,3 +243,5 @@ class Blob < SimpleDelegator classes.find { |viewer_class| viewer_class.can_render?(self, verify_binary: verify_binary) } end end + +Blob.prepend_if_ee('EE::Blob') diff --git a/app/models/board.rb b/app/models/board.rb index b5d07f1b282..31011dc4742 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -41,3 +41,5 @@ class Board < ApplicationRecord false end end + +Board.prepend_if_ee('EE::Board') diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 1338a585c9e..dfcf28763ee 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -76,3 +76,5 @@ class BroadcastMessage < ApplicationRecord self.class.cache.expire(CACHE_KEY) end end + +BroadcastMessage.prepend_if_ee('EE::BroadcastMessage') diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb index 644716ba8e7..6c51f650b6a 100644 --- a/app/models/ci/bridge.rb +++ b/app/models/ci/bridge.rb @@ -56,3 +56,5 @@ module Ci end end end + +::Ci::Bridge.prepend_if_ee('::EE::Ci::Bridge') diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 72782827906..71c4501f57b 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -868,3 +868,5 @@ module Ci end end end + +Ci::Build.prepend_if_ee('EE::Ci::Build') diff --git a/app/models/ci/build_runner_session.rb b/app/models/ci/build_runner_session.rb index 8075c15bbaf..b46bbe69c7c 100644 --- a/app/models/ci/build_runner_session.rb +++ b/app/models/ci/build_runner_session.rb @@ -37,3 +37,5 @@ module Ci end end end + +Ci::BuildRunnerSession.prepend_if_ee('EE::Ci::BuildRunnerSession') diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index b4497d8af09..da2758507ce 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -198,3 +198,5 @@ module Ci end end end + +Ci::JobArtifact.prepend_if_ee('EE::Ci::JobArtifact') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 29317cd530d..0c331b0b8c9 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -904,3 +904,5 @@ module Ci end end end + +Ci::Pipeline.prepend_if_ee('EE::Ci::Pipeline') diff --git a/app/models/ci/pipeline_enums.rb b/app/models/ci/pipeline_enums.rb index 0c2bd0aa8eb..cb92aef4bda 100644 --- a/app/models/ci/pipeline_enums.rb +++ b/app/models/ci/pipeline_enums.rb @@ -39,3 +39,5 @@ module Ci end end end + +Ci::PipelineEnums.prepend_if_ee('EE::Ci::PipelineEnums') diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index e0e905ebfa8..c4a4410e8fc 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -35,7 +35,7 @@ module Ci FORM_EDITABLE = %i[description tag_list active run_untagged locked access_level maximum_timeout_human_readable].freeze - self.ignored_columns = %i[is_shared] + self.ignored_columns += %i[is_shared] has_many :builds has_many :runner_projects, inverse_of: :runner, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent @@ -335,3 +335,5 @@ module Ci end end end + +Ci::Runner.prepend_if_ee('EE::Ci::Runner') diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index f31a6b8b50e..7a414d1a5bb 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -117,3 +117,5 @@ module Clusters end end end + +Clusters::Applications::Prometheus.prepend_if_ee('EE::Clusters::Applications::Prometheus') diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index a976093ac0c..7855fb69bd6 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -268,3 +268,5 @@ module Clusters end end end + +Clusters::Cluster.prepend_if_ee('EE::Clusters::Cluster') diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index 37614fbe3ca..89b50d8e8ff 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -201,3 +201,5 @@ module Clusters end end end + +Clusters::Platforms::Kubernetes.prepend_if_ee('EE::Clusters::Platforms::Kubernetes') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 4be4d95b4a1..5d9d3179f9d 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -7,6 +7,8 @@ class CommitStatus < ApplicationRecord include Presentable include EnumWithNil + prepend_if_ee('::EE::CommitStatus') # rubocop: disable Cop/InjectEnterpriseEditionModule + self.table_name = 'ci_builds' belongs_to :user diff --git a/app/models/commit_status_enums.rb b/app/models/commit_status_enums.rb index 45e08fa18fe..a540e291990 100644 --- a/app/models/commit_status_enums.rb +++ b/app/models/commit_status_enums.rb @@ -19,3 +19,5 @@ module CommitStatusEnums } end end + +CommitStatusEnums.prepend_if_ee('EE::CommitStatusEnums') diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index a998d9b7e1b..d02f3731cc2 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -439,3 +439,6 @@ module Issuable respond_to?(:milestone_id) end end + +Issuable.prepend_if_ee('EE::Issuable') # rubocop: disable Cop/InjectEnterpriseEditionModule +Issuable::ClassMethods.prepend_if_ee('EE::Issuable::ClassMethods') diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 2f3f9b399d9..377600ef6e5 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -172,3 +172,5 @@ module Mentionable {} end end + +Mentionable.prepend_if_ee('EE::Mentionable') diff --git a/app/models/concerns/mentionable/reference_regexes.rb b/app/models/concerns/mentionable/reference_regexes.rb index b8fb3f71925..fec31cd262b 100644 --- a/app/models/concerns/mentionable/reference_regexes.rb +++ b/app/models/concerns/mentionable/reference_regexes.rb @@ -34,3 +34,5 @@ module Mentionable end end end + +Mentionable::ReferenceRegexes.prepend_if_ee('EE::Mentionable::ReferenceRegexes') diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb index b3e4df730b4..6caa23ef9b7 100644 --- a/app/models/concerns/noteable.rb +++ b/app/models/concerns/noteable.rb @@ -143,3 +143,6 @@ module Noteable end Noteable.extend(Noteable::ClassMethods) + +Noteable::ClassMethods.prepend_if_ee('EE::Noteable::ClassMethods') # rubocop: disable Cop/InjectEnterpriseEditionModule +Noteable.prepend_if_ee('EE::Noteable') diff --git a/app/models/concerns/participable.rb b/app/models/concerns/participable.rb index b140fca9b83..af105629398 100644 --- a/app/models/concerns/participable.rb +++ b/app/models/concerns/participable.rb @@ -25,7 +25,6 @@ # users = issue.participants module Participable extend ActiveSupport::Concern - class_methods do # Adds a list of participant attributes. Attributes can either be symbols or # Procs. @@ -112,3 +111,5 @@ module Participable end end end + +Participable.prepend_if_ee('EE::Participable') diff --git a/app/models/concerns/prometheus_adapter.rb b/app/models/concerns/prometheus_adapter.rb index 9ac4722c6b1..aab0589f7ca 100644 --- a/app/models/concerns/prometheus_adapter.rb +++ b/app/models/concerns/prometheus_adapter.rb @@ -5,6 +5,8 @@ module PrometheusAdapter included do include ReactiveCaching + # We can't prepend outside of this model due to the use of `included`, so this must stay here. + prepend_if_ee('EE::PrometheusAdapter') # rubocop: disable Cop/InjectEnterpriseEditionModule self.reactive_cache_lease_timeout = 30.seconds self.reactive_cache_refresh_interval = 30.seconds diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb index 0648b4a78e1..ebacc459cb5 100644 --- a/app/models/concerns/protected_ref.rb +++ b/app/models/concerns/protected_ref.rb @@ -67,3 +67,9 @@ module ProtectedRef @ref_matcher ||= RefMatcher.new(self.name) end end + +# Prepending a module into a concern doesn't work very well for class methods, +# since these are defined in a ClassMethods constant. As such, we prepend the +# module directly into ProtectedRef::ClassMethods, instead of prepending it into +# ProtectedRef. +ProtectedRef::ClassMethods.prepend_if_ee('EE::ProtectedRef') diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index 208937f2aff..01cb5a14762 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -2,7 +2,6 @@ module ProtectedRefAccess extend ActiveSupport::Concern - HUMAN_ACCESS_LEVELS = { Gitlab::Access::MAINTAINER => "Maintainers", Gitlab::Access::DEVELOPER => "Developers + Maintainers", @@ -51,3 +50,13 @@ module ProtectedRefAccess project.team.max_member_access(user.id) >= access_level end end + +ProtectedRefAccess.include_if_ee('EE::ProtectedRefAccess::Scopes') # rubocop: disable Cop/InjectEnterpriseEditionModule +ProtectedRefAccess.prepend_if_ee('EE::ProtectedRefAccess') # rubocop: disable Cop/InjectEnterpriseEditionModule + +# When using `prepend` (or `include` for that matter), the `ClassMethods` +# constants are not merged. This means that `class_methods` in +# `EE::ProtectedRefAccess` would be ignored. +# +# To work around this, we prepend the `ClassMethods` constant manually. +ProtectedRefAccess::ClassMethods.prepend_if_ee('EE::ProtectedRefAccess::ClassMethods') diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index 70ac873a030..177004deba6 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -47,3 +47,5 @@ module ShaAttribute end end end + +ShaAttribute::ClassMethods.prepend_if_ee('EE::ShaAttribute') diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb index 2a5ae7930e6..583e23d1274 100644 --- a/app/models/container_repository.rb +++ b/app/models/container_repository.rb @@ -96,3 +96,5 @@ class ContainerRepository < ApplicationRecord name: path.repository_name) end end + +ContainerRepository.prepend_if_ee('EE::ContainerRepository') diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index 861185dc222..0b00cf10714 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -173,3 +173,5 @@ class DiffNote < Note noteable.respond_to?(:repository) ? noteable.repository : project.repository end end + +DiffNote.prepend_if_ee('::EE::DiffNote') diff --git a/app/models/discussion_note.rb b/app/models/discussion_note.rb index 142cbdcdfa6..5049107da2c 100644 --- a/app/models/discussion_note.rb +++ b/app/models/discussion_note.rb @@ -4,6 +4,9 @@ # # A note of this type can be resolvable. class DiscussionNote < Note + # This prepend must stay here because the `validates` below depends on it. + prepend_if_ee('EE::DiscussionNote') # rubocop: disable Cop/InjectEnterpriseEditionModule + # Names of all implementers of `Noteable` that support discussions. def self.noteable_types %w(MergeRequest Issue Commit Snippet) diff --git a/app/models/environment.rb b/app/models/environment.rb index 1b53c4b45f9..3d3edcbbe66 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -246,3 +246,5 @@ class Environment < ApplicationRecord self.slug = Gitlab::Slug::Environment.new(name).generate end end + +Environment.prepend_if_ee('EE::Environment') diff --git a/app/models/epic.rb b/app/models/epic.rb index 3693db1de33..46723462590 100644 --- a/app/models/epic.rb +++ b/app/models/epic.rb @@ -15,3 +15,5 @@ class Epic < ApplicationRecord '&' end end + +Epic.prepend_if_ee('EE::Epic') diff --git a/app/models/event.rb b/app/models/event.rb index 580bb770599..205e1f71c74 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -409,3 +409,5 @@ class Event < ApplicationRecord UserInteractedProject.track(self) if UserInteractedProject.available? end end + +Event.prepend_if_ee('EE::Event') diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index 59f5a7703e2..1d553fc8312 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -2,6 +2,7 @@ # Global Milestones are milestones that can be shared across multiple projects class GlobalMilestone include Milestoneish + include_if_ee('::EE::GlobalMilestone') # rubocop: disable Cop/InjectEnterpriseEditionModule STATE_COUNT_HASH = { opened: 0, closed: 0, all: 0 }.freeze diff --git a/app/models/group.rb b/app/models/group.rb index abe93cf3c84..1b62db04ab7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -465,3 +465,5 @@ class Group < Namespace errors.add(:visibility_level, "#{visibility} is not allowed since there are sub-groups with higher visibility.") end end + +Group.prepend_if_ee('EE::Group') diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb index 97cb26c6ea9..bfda603c3cb 100644 --- a/app/models/group_milestone.rb +++ b/app/models/group_milestone.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true # Group Milestones are milestones that can be shared among many projects within the same group class GroupMilestone < GlobalMilestone + include_if_ee('::EE::GroupMilestone') # rubocop: disable Cop/InjectEnterpriseEditionModule attr_reader :group, :milestones def self.build_collection(group, projects, params) diff --git a/app/models/hooks/project_hook.rb b/app/models/hooks/project_hook.rb index 18c387f0d34..65e3eaf31e7 100644 --- a/app/models/hooks/project_hook.rb +++ b/app/models/hooks/project_hook.rb @@ -19,3 +19,5 @@ class ProjectHook < WebHook belongs_to :project validates :project, presence: true end + +ProjectHook.prepend_if_ee('EE::ProjectHook') diff --git a/app/models/identity.rb b/app/models/identity.rb index 1cbd50205ed..cb7fd553255 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -47,3 +47,5 @@ class Identity < ApplicationRecord user.user_synced_attributes_metadata&.destroy end end + +Identity.prepend_if_ee('EE::Identity') diff --git a/app/models/identity/uniqueness_scopes.rb b/app/models/identity/uniqueness_scopes.rb index ce68371ae87..c1890865a1c 100644 --- a/app/models/identity/uniqueness_scopes.rb +++ b/app/models/identity/uniqueness_scopes.rb @@ -9,3 +9,5 @@ class Identity < ApplicationRecord end end end + +Identity::UniquenessScopes.prepend_if_ee('EE::Identity::UniquenessScopes') diff --git a/app/models/issue.rb b/app/models/issue.rb index 7c5a139ab55..d0b2165fcc7 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -27,6 +27,7 @@ class Issue < ApplicationRecord belongs_to :project belongs_to :moved_to, class_name: 'Issue' + belongs_to :duplicated_to, class_name: 'Issue' belongs_to :closed_by, class_name: 'User' has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.issues&.maximum(:iid) } @@ -181,6 +182,10 @@ class Issue < ApplicationRecord !moved_to_id.nil? end + def duplicated? + !duplicated_to_id.nil? + end + def can_move?(user, to_project = nil) if to_project return false unless user.can?(:admin_issue, to_project) @@ -293,3 +298,5 @@ class Issue < ApplicationRecord Gitlab::EtagCaching::Store.new.touch(key) end end + +Issue.prepend_if_ee('EE::Issue') diff --git a/app/models/issue_assignee.rb b/app/models/issue_assignee.rb index fbd9be1fb43..748f73373e3 100644 --- a/app/models/issue_assignee.rb +++ b/app/models/issue_assignee.rb @@ -4,3 +4,5 @@ class IssueAssignee < ApplicationRecord belongs_to :issue belongs_to :assignee, class_name: "User", foreign_key: :user_id end + +IssueAssignee.prepend_if_ee('EE::IssueAssignee') diff --git a/app/models/key.rb b/app/models/key.rb index 8aa25924c28..ff601966c26 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -140,3 +140,5 @@ class Key < ApplicationRecord "type is forbidden. Must be #{allowed_types}" end end + +Key.prepend_if_ee('EE::Key') diff --git a/app/models/label.rb b/app/models/label.rb index dc9f0a3d1a9..ea200b4937a 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -272,3 +272,5 @@ class Label < ApplicationRecord %w(color title).each { |attr| self[attr] = self[attr]&.strip } end end + +Label.prepend_if_ee('EE::Label') diff --git a/app/models/label_note.rb b/app/models/label_note.rb index ba5f1f82a81..13a2e1b0c72 100644 --- a/app/models/label_note.rb +++ b/app/models/label_note.rb @@ -103,3 +103,5 @@ class LabelNote < Note events.select { |e| e.action == action }.map(&field) end end + +LabelNote.prepend_if_ee('EE::LabelNote') diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb index e2c75bc7ee9..df1ad8ea281 100644 --- a/app/models/legacy_diff_note.rb +++ b/app/models/legacy_diff_note.rb @@ -111,3 +111,5 @@ class LegacyDiffNote < Note diffs.find { |d| d.new_path == self.diff.new_path } end end + +LegacyDiffNote.prepend_if_ee('EE::LegacyDiffNote') diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb index 40695a97d97..60b11ad9356 100644 --- a/app/models/lfs_object.rb +++ b/app/models/lfs_object.rb @@ -42,3 +42,5 @@ class LfsObject < ApplicationRecord Digest::SHA256.file(path).hexdigest end end + +LfsObject.prepend_if_ee('EE::LfsObject') diff --git a/app/models/list.rb b/app/models/list.rb index ae7085f05a7..84c63f3fd6f 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -3,6 +3,8 @@ class List < ApplicationRecord include Importable + prepend_if_ee('::EE::List') # rubocop: disable Cop/InjectEnterpriseEditionModule + belongs_to :board belongs_to :label has_many :list_user_preferences diff --git a/app/models/member.rb b/app/models/member.rb index 6457fe9ef0c..e2d26773d45 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -459,3 +459,5 @@ class Member < ApplicationRecord end end end + +Member.prepend_if_ee('EE::Member') diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb index ed5832ff989..bdff9e28df1 100644 --- a/app/models/members/group_member.rb +++ b/app/models/members/group_member.rb @@ -76,3 +76,5 @@ class GroupMember < Member super end end + +GroupMember.prepend_if_ee('EE::GroupMember') diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index 2bb5806cd21..68c51860c47 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -146,3 +146,5 @@ class ProjectMember < Member end # rubocop: enable CodeReuse/ServiceClass end + +ProjectMember.prepend_if_ee('EE::ProjectMember') diff --git a/app/models/members_preloader.rb b/app/models/members_preloader.rb index 33855191ca8..1ed0434eacf 100644 --- a/app/models/members_preloader.rb +++ b/app/models/members_preloader.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class MembersPreloader + prepend_if_ee('EE::MembersPreloader') # rubocop: disable Cop/InjectEnterpriseEditionModule + attr_reader :members def initialize(members) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 74f8067db0a..90061fe181e 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -23,6 +23,8 @@ class MergeRequest < ApplicationRecord SORTING_PREFERENCE_FIELD = :merge_requests_sort + prepend_if_ee('::EE::MergeRequest') # rubocop: disable Cop/InjectEnterpriseEditionModule + belongs_to :target_project, class_name: "Project" belongs_to :source_project, class_name: "Project" belongs_to :merge_user, class_name: "User" diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 7f46e5faf1a..4b9fee2bbdf 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -19,6 +19,8 @@ class Milestone < ApplicationRecord include FromUnion include Gitlab::SQL::Pattern + prepend_if_ee('::EE::Milestone') # rubocop: disable Cop/InjectEnterpriseEditionModule + cache_markdown_field :title, pipeline: :single_line cache_markdown_field :description diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 9f9c4288667..9a7c3dc03c3 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -354,3 +354,5 @@ class Namespace < ApplicationRecord end end end + +Namespace.prepend_if_ee('EE::Namespace') diff --git a/app/models/note.rb b/app/models/note.rb index 62b3f47fadd..7a62d70ca5d 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -520,3 +520,5 @@ class Note < ApplicationRecord system_note_metadata&.cross_reference_types&.include?(system_note_metadata&.action) end end + +Note.prepend_if_ee('EE::Note') diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index bf2aec74ec8..981590b688f 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -80,3 +80,5 @@ class NotificationSetting < ApplicationRecord respond_to?(event) && !!public_send(event) # rubocop:disable GitlabSecurity/PublicSend end end + +NotificationSetting.prepend_if_ee('EE::NotificationSetting') diff --git a/app/models/pool_repository.rb b/app/models/pool_repository.rb index 50eed7344bd..25eab6e4e03 100644 --- a/app/models/pool_repository.rb +++ b/app/models/pool_repository.rb @@ -114,3 +114,5 @@ class PoolRepository < ApplicationRecord .new(self, prefix: Storage::HashedProject::POOL_PATH_PREFIX) end end + +PoolRepository.prepend_if_ee('EE::PoolRepository') diff --git a/app/models/project.rb b/app/models/project.rb index 12f5da05efa..04d68d31812 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2331,3 +2331,5 @@ class Project < ApplicationRecord @services_templates ||= Service.where(template: true) end end + +Project.prepend_if_ee('EE::Project') diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb index f95d3ab54e2..e81d9d0f5fe 100644 --- a/app/models/project_authorization.rb +++ b/app/models/project_authorization.rb @@ -2,6 +2,7 @@ class ProjectAuthorization < ApplicationRecord include FromUnion + prepend_if_ee('::EE::ProjectAuthorization') # rubocop: disable Cop/InjectEnterpriseEditionModule belongs_to :user belongs_to :project diff --git a/app/models/project_ci_cd_setting.rb b/app/models/project_ci_cd_setting.rb index 821e022f51b..a495d34c07c 100644 --- a/app/models/project_ci_cd_setting.rb +++ b/app/models/project_ci_cd_setting.rb @@ -36,3 +36,5 @@ class ProjectCiCdSetting < ApplicationRecord self.default_git_depth ||= DEFAULT_GIT_DEPTH end end + +ProjectCiCdSetting.prepend_if_ee('EE::ProjectCiCdSetting') diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index efa3fbcf015..13b20b1fead 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -180,3 +180,5 @@ class ProjectFeature < ApplicationRecord project.team.member?(user, ProjectFeature.required_minimum_access_level(feature)) end end + +ProjectFeature.prepend_if_ee('EE::ProjectFeature') diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb index feaf172d48d..0d3a2d4e398 100644 --- a/app/models/project_group_link.rb +++ b/app/models/project_group_link.rb @@ -52,3 +52,5 @@ class ProjectGroupLink < ApplicationRecord group.refresh_members_authorized_projects end end + +ProjectGroupLink.prepend_if_ee('EE::ProjectGroupLink') diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb index 580e8dfd833..87ac6d38787 100644 --- a/app/models/project_import_data.rb +++ b/app/models/project_import_data.rb @@ -3,6 +3,8 @@ require 'carrierwave/orm/activerecord' class ProjectImportData < ApplicationRecord + prepend_if_ee('::EE::ProjectImportData') # rubocop: disable Cop/InjectEnterpriseEditionModule + belongs_to :project, inverse_of: :import_data attr_encrypted :credentials, key: Settings.attr_encrypted_db_key_base, diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb index 23adffb33d8..bff00816e15 100644 --- a/app/models/project_import_state.rb +++ b/app/models/project_import_state.rb @@ -99,3 +99,5 @@ class ProjectImportState < ApplicationRecord Gitlab::SidekiqStatus.set(jid, StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) end end + +ProjectImportState.prepend_if_ee('EE::ProjectImportState') diff --git a/app/models/project_services/chat_message/merge_message.rb b/app/models/project_services/chat_message/merge_message.rb index 6b7a35aaa75..46313ba7bec 100644 --- a/app/models/project_services/chat_message/merge_message.rb +++ b/app/models/project_services/chat_message/merge_message.rb @@ -2,6 +2,8 @@ module ChatMessage class MergeMessage < BaseMessage + prepend_if_ee('::EE::ChatMessage::MergeMessage') # rubocop: disable Cop/InjectEnterpriseEditionModule + attr_reader :merge_request_iid attr_reader :source_branch attr_reader :target_branch diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index a69b7b4c4b6..3320405e9e9 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -309,3 +309,5 @@ class HipchatService < Service end end end + +HipchatService.prepend_if_ee('EE::HipchatService') diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index 3a1130ffc15..b6ad46513db 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -146,3 +146,5 @@ class IssueTrackerService < Service end end end + +IssueTrackerService.prepend_if_ee('EE::IssueTrackerService') diff --git a/app/models/project_services/mock_deployment_service.rb b/app/models/project_services/mock_deployment_service.rb index 6f2b0f7747f..f80819de9fb 100644 --- a/app/models/project_services/mock_deployment_service.rb +++ b/app/models/project_services/mock_deployment_service.rb @@ -32,3 +32,5 @@ class MockDeploymentService < Service false end end + +MockDeploymentService.prepend_if_ee('EE::MockDeploymentService') diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb index 47999a3694e..b71ed75dde6 100644 --- a/app/models/project_statistics.rb +++ b/app/models/project_statistics.rb @@ -97,3 +97,5 @@ class ProjectStatistics < ApplicationRecord end end end + +ProjectStatistics.prepend_if_ee('EE::ProjectStatistics') diff --git a/app/models/project_team.rb b/app/models/project_team.rb index aeba2843e5d..de1fc55ba93 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -204,3 +204,5 @@ class ProjectTeam Member.on_project_and_ancestors(project).select(:user_id) end end + +ProjectTeam.prepend_if_ee('EE::ProjectTeam') diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 4a19e05bf76..218be974218 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -225,3 +225,5 @@ class ProjectWiki @project.touch(:last_activity_at, :last_repository_updated_at) end end + +ProjectWiki.prepend_if_ee('EE::ProjectWiki') diff --git a/app/models/prometheus_metric.rb b/app/models/prometheus_metric.rb index c7786500c5c..08f4df7ea01 100644 --- a/app/models/prometheus_metric.rb +++ b/app/models/prometheus_metric.rb @@ -67,3 +67,5 @@ class PrometheusMetric < ApplicationRecord PrometheusMetricEnums.group_details.fetch(group.to_sym) end end + +PrometheusMetric.prepend_if_ee('EE::PrometheusMetric') diff --git a/app/models/prometheus_metric_enums.rb b/app/models/prometheus_metric_enums.rb index d58f825f222..cdd5e2acfce 100644 --- a/app/models/prometheus_metric_enums.rb +++ b/app/models/prometheus_metric_enums.rb @@ -76,3 +76,5 @@ module PrometheusMetricEnums }.freeze end end + +PrometheusMetricEnums.prepend_if_ee('EE::PrometheusMetricEnums') diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 9fd929371f8..8769d3eb916 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -41,3 +41,5 @@ class ProtectedBranch < ApplicationRecord project.protected_branches.select(:name) end end + +ProtectedBranch.prepend_if_ee('EE::ProtectedBranch') diff --git a/app/models/push_event_payload.rb b/app/models/push_event_payload.rb index 537859ec7b7..6a32c480b04 100644 --- a/app/models/push_event_payload.rb +++ b/app/models/push_event_payload.rb @@ -22,3 +22,5 @@ class PushEventPayload < ApplicationRecord tag: 1 } end + +PushEventPayload.prepend_if_ee('EE::PushEventPayload') diff --git a/app/models/remote_mirror.rb b/app/models/remote_mirror.rb index 41e63986286..c165a1a9b0d 100644 --- a/app/models/remote_mirror.rb +++ b/app/models/remote_mirror.rb @@ -304,3 +304,5 @@ class RemoteMirror < ApplicationRecord saved_change_to_url? || saved_change_to_credentials? end end + +RemoteMirror.prepend_if_ee('EE::RemoteMirror') diff --git a/app/models/repository.rb b/app/models/repository.rb index e5a83366776..9d6413c5991 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1172,3 +1172,5 @@ class Repository project.full_path) end end + +Repository.prepend_if_ee('EE::Repository') diff --git a/app/models/resource_label_event.rb b/app/models/resource_label_event.rb index ad08f4763ae..a6aa9ce0e7a 100644 --- a/app/models/resource_label_event.rb +++ b/app/models/resource_label_event.rb @@ -125,3 +125,5 @@ class ResourceLabelEvent < ApplicationRecord [self.class.name, created_at, user_id] end end + +ResourceLabelEvent.prepend_if_ee('EE::ResourceLabelEvent') diff --git a/app/models/service.rb b/app/models/service.rb index d866a51c42e..43ed0c7dfaa 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -352,3 +352,5 @@ class Service < ApplicationRecord activated? && !importing? end end + +Service.prepend_if_ee('EE::Service') diff --git a/app/models/snippet.rb b/app/models/snippet.rb index b2fca65b9e0..273a42e6034 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -227,3 +227,5 @@ class Snippet < ApplicationRecord end end end + +Snippet.prepend_if_ee('EE::Snippet') diff --git a/app/models/system_note_metadata.rb b/app/models/system_note_metadata.rb index a19755d286a..8ec90ca25d3 100644 --- a/app/models/system_note_metadata.rb +++ b/app/models/system_note_metadata.rb @@ -32,3 +32,5 @@ class SystemNoteMetadata < ApplicationRecord TYPES_WITH_CROSS_REFERENCES end end + +SystemNoteMetadata.prepend_if_ee('EE::SystemNoteMetadata') diff --git a/app/models/todo.rb b/app/models/todo.rb index f7f30aed832..aefd9d5ef28 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -207,3 +207,5 @@ class Todo < ApplicationRecord project.repository.keep_around(self.commit_id) end end + +Todo.prepend_if_ee('EE::Todo') diff --git a/app/models/upload.rb b/app/models/upload.rb index ca74f16b3b8..7560002ada8 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -125,3 +125,5 @@ class Upload < ApplicationRecord super&.to_sym end end + +Upload.prepend_if_ee('EE::Upload') diff --git a/app/models/user.rb b/app/models/user.rb index 48acdfeb2ed..c10a4143d1c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1668,3 +1668,5 @@ class User < ApplicationRecord project_creation_level: project_creation_levels) end end + +User.prepend_if_ee('EE::User') diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb index 7b68e5076c7..772170a6b5b 100644 --- a/app/models/user_callout_enums.rb +++ b/app/models/user_callout_enums.rb @@ -18,3 +18,5 @@ module UserCalloutEnums } end end + +UserCalloutEnums.prepend_if_ee('EE::UserCalloutEnums') diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index b236250c24e..a36f56089a0 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -55,3 +55,5 @@ class UserPreference < ApplicationRecord "#{field_key}_notes_filter" end end + +UserPreference.prepend_if_ee('EE::UserPreference') diff --git a/app/policies/base_policy.rb b/app/policies/base_policy.rb index 82bf9bf8bf6..78379516062 100644 --- a/app/policies/base_policy.rb +++ b/app/policies/base_policy.rb @@ -36,3 +36,5 @@ class BasePolicy < DeclarativePolicy::Base rule { default }.enable :read_cross_project end + +BasePolicy.prepend_if_ee('EE::BasePolicy') diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb index 0ca3e696f46..ebb99270b9a 100644 --- a/app/policies/ci/build_policy.rb +++ b/app/policies/ci/build_policy.rb @@ -44,3 +44,5 @@ module Ci rule { can?(:update_build) & terminal }.enable :create_build_terminal end end + +Ci::BuildPolicy.prepend_if_ee('EE::Ci::BuildPolicy') diff --git a/app/policies/concerns/policy_actor.rb b/app/policies/concerns/policy_actor.rb index 069d065280e..b963a64b429 100644 --- a/app/policies/concerns/policy_actor.rb +++ b/app/policies/concerns/policy_actor.rb @@ -34,3 +34,5 @@ module PolicyActor false end end + +PolicyActor.prepend_if_ee('EE::PolicyActor') diff --git a/app/policies/environment_policy.rb b/app/policies/environment_policy.rb index d1243491f5a..be512dd3b94 100644 --- a/app/policies/environment_policy.rb +++ b/app/policies/environment_policy.rb @@ -14,3 +14,5 @@ class EnvironmentPolicy < BasePolicy rule { stop_with_deployment_allowed | stop_with_update_allowed }.enable :stop_environment end + +EnvironmentPolicy.prepend_if_ee('EE::EnvironmentPolicy') diff --git a/app/policies/global_policy.rb b/app/policies/global_policy.rb index 311aab0dcd4..659fde574fc 100644 --- a/app/policies/global_policy.rb +++ b/app/policies/global_policy.rb @@ -75,3 +75,5 @@ class GlobalPolicy < BasePolicy enable :update_custom_attribute end end + +GlobalPolicy.prepend_if_ee('EE::GlobalPolicy') diff --git a/app/policies/group_member_policy.rb b/app/policies/group_member_policy.rb index 6f1afb87c85..f6e52def270 100644 --- a/app/policies/group_member_policy.rb +++ b/app/policies/group_member_policy.rb @@ -22,3 +22,5 @@ class GroupMemberPolicy < BasePolicy enable :destroy_group_member end end + +GroupMemberPolicy.prepend_if_ee('EE::GroupMemberPolicy') diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb index c726c7c24a7..f56ac0a5279 100644 --- a/app/policies/group_policy.rb +++ b/app/policies/group_policy.rb @@ -138,3 +138,5 @@ class GroupPolicy < BasePolicy @subject.max_member_access_for_user(@user) end end + +GroupPolicy.prepend_if_ee('EE::GroupPolicy') diff --git a/app/policies/identity_provider_policy.rb b/app/policies/identity_provider_policy.rb index d34cdd5bdd4..6d6dcaebff8 100644 --- a/app/policies/identity_provider_policy.rb +++ b/app/policies/identity_provider_policy.rb @@ -13,3 +13,5 @@ class IdentityProviderPolicy < BasePolicy rule { protected_provider }.prevent(:unlink) end + +IdentityProviderPolicy.prepend_if_ee('EE::IdentityProviderPolicy') diff --git a/app/policies/issue_policy.rb b/app/policies/issue_policy.rb index fa252af55e4..f86892227df 100644 --- a/app/policies/issue_policy.rb +++ b/app/policies/issue_policy.rb @@ -26,3 +26,5 @@ class IssuePolicy < IssuablePolicy prevent :reopen_issue end end + +IssuePolicy.prepend_if_ee('::EE::IssuePolicy') diff --git a/app/policies/merge_request_policy.rb b/app/policies/merge_request_policy.rb index 5ad7bdabdff..e2aca2a37d5 100644 --- a/app/policies/merge_request_policy.rb +++ b/app/policies/merge_request_policy.rb @@ -11,3 +11,5 @@ class MergeRequestPolicy < IssuablePolicy # note permissions are shared, and this would apply too broadly. rule { ~can?(:read_merge_request) }.prevent :create_note end + +MergeRequestPolicy.prepend_if_ee('EE::MergeRequestPolicy') diff --git a/app/policies/namespace_policy.rb b/app/policies/namespace_policy.rb index 937666c7e54..fd3bdddded6 100644 --- a/app/policies/namespace_policy.rb +++ b/app/policies/namespace_policy.rb @@ -16,3 +16,5 @@ class NamespacePolicy < BasePolicy rule { personal_project & ~can_create_personal_project }.prevent :create_projects end + +NamespacePolicy.prepend_if_ee('EE::NamespacePolicy') diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 5c36b59f07b..e6f8d1052ed 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -519,3 +519,5 @@ class ProjectPolicy < BasePolicy @subject end end + +ProjectPolicy.prepend_if_ee('EE::ProjectPolicy') diff --git a/app/policies/project_snippet_policy.rb b/app/policies/project_snippet_policy.rb index e5e005cee6d..424558be1fe 100644 --- a/app/policies/project_snippet_policy.rb +++ b/app/policies/project_snippet_policy.rb @@ -46,3 +46,5 @@ class ProjectSnippetPolicy < BasePolicy rule { ~can?(:read_project_snippet) }.prevent :create_note end + +ProjectSnippetPolicy.prepend_if_ee('EE::ProjectSnippetPolicy') diff --git a/app/policies/protected_branch_policy.rb b/app/policies/protected_branch_policy.rb index 0e83d2e5834..1a5c6528b82 100644 --- a/app/policies/protected_branch_policy.rb +++ b/app/policies/protected_branch_policy.rb @@ -9,3 +9,5 @@ class ProtectedBranchPolicy < BasePolicy enable :destroy_protected_branch end end + +ProtectedBranchPolicy.prepend_if_ee('EE::ProtectedBranchPolicy') diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index a96f97988b2..73a048dfa56 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -91,3 +91,5 @@ module Ci end end end + +Ci::PipelinePresenter.prepend_if_ee('EE::Ci::PipelinePresenter') diff --git a/app/presenters/clusterable_presenter.rb b/app/presenters/clusterable_presenter.rb index 49c64b31fc7..34dffbf40fd 100644 --- a/app/presenters/clusterable_presenter.rb +++ b/app/presenters/clusterable_presenter.rb @@ -81,3 +81,5 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated clusterable.clusters.empty? end end + +ClusterablePresenter.prepend_if_ee('EE::ClusterablePresenter') diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb index 28a25c8b7a3..f1182ec26f4 100644 --- a/app/presenters/commit_status_presenter.rb +++ b/app/presenters/commit_status_presenter.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true - class CommitStatusPresenter < Gitlab::View::Presenter::Delegated CALLOUT_FAILURE_MESSAGES = { unknown_failure: 'There is an unknown failure, please try again', @@ -19,6 +18,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated presents :build + prepend_if_ee('::EE::CommitStatusPresenter') # rubocop: disable Cop/InjectEnterpriseEditionModule + def self.callout_failure_messages CALLOUT_FAILURE_MESSAGES end diff --git a/app/presenters/group_clusterable_presenter.rb b/app/presenters/group_clusterable_presenter.rb index f5b0bb64487..54cea19b18e 100644 --- a/app/presenters/group_clusterable_presenter.rb +++ b/app/presenters/group_clusterable_presenter.rb @@ -39,3 +39,5 @@ class GroupClusterablePresenter < ClusterablePresenter link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer') end end + +GroupClusterablePresenter.prepend_if_ee('EE::GroupClusterablePresenter') diff --git a/app/presenters/group_member_presenter.rb b/app/presenters/group_member_presenter.rb index c4dcc9e60f9..df51f1eb075 100644 --- a/app/presenters/group_member_presenter.rb +++ b/app/presenters/group_member_presenter.rb @@ -15,3 +15,5 @@ class GroupMemberPresenter < MemberPresenter :destroy_group_member end end + +GroupMemberPresenter.prepend_if_ee('EE::GroupMemberPresenter') diff --git a/app/presenters/instance_clusterable_presenter.rb b/app/presenters/instance_clusterable_presenter.rb index cce400ad2a1..908cd17678d 100644 --- a/app/presenters/instance_clusterable_presenter.rb +++ b/app/presenters/instance_clusterable_presenter.rb @@ -67,3 +67,5 @@ class InstanceClusterablePresenter < ClusterablePresenter link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer') end end + +InstanceClusterablePresenter.prepend_if_ee('EE::InstanceClusterablePresenter') diff --git a/app/presenters/label_presenter.rb b/app/presenters/label_presenter.rb index 1077bf543d9..68aa05ada8e 100644 --- a/app/presenters/label_presenter.rb +++ b/app/presenters/label_presenter.rb @@ -49,3 +49,5 @@ class LabelPresenter < Gitlab::View::Presenter::Delegated issuable_subject || label.try(:subject) end end + +LabelPresenter.prepend_if_ee('EE::LabelPresenter') diff --git a/app/presenters/member_presenter.rb b/app/presenters/member_presenter.rb index 2561c3f0244..0c67fc98ced 100644 --- a/app/presenters/member_presenter.rb +++ b/app/presenters/member_presenter.rb @@ -51,3 +51,5 @@ class MemberPresenter < Gitlab::View::Presenter::Delegated raise NotImplementedError end end + +MemberPresenter.prepend_if_ee('EE::MemberPresenter') diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index 919d2653ec8..af98a6ee36a 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -258,3 +258,5 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated can?(current_user, :fork_project, project) end end + +MergeRequestPresenter.prepend_if_ee('EE::MergeRequestPresenter') diff --git a/app/presenters/project_clusterable_presenter.rb b/app/presenters/project_clusterable_presenter.rb index 8661ee02b68..3fab69fff7a 100644 --- a/app/presenters/project_clusterable_presenter.rb +++ b/app/presenters/project_clusterable_presenter.rb @@ -34,3 +34,5 @@ class ProjectClusterablePresenter < ClusterablePresenter link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') end end + +ProjectClusterablePresenter.prepend_if_ee('EE::ProjectClusterablePresenter') diff --git a/app/presenters/project_member_presenter.rb b/app/presenters/project_member_presenter.rb index e4731074e86..ff9c3df793a 100644 --- a/app/presenters/project_member_presenter.rb +++ b/app/presenters/project_member_presenter.rb @@ -15,3 +15,5 @@ class ProjectMemberPresenter < MemberPresenter :destroy_project_member end end + +ProjectMemberPresenter.prepend_if_ee('EE::ProjectMemberPresenter') diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 9afbaf035c7..6c300cd8be1 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -355,3 +355,5 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ) end end + +ProjectPresenter.prepend_if_ee('EE::ProjectPresenter') diff --git a/app/serializers/blob_entity.rb b/app/serializers/blob_entity.rb index 3ac61481dea..a54af899ba2 100644 --- a/app/serializers/blob_entity.rb +++ b/app/serializers/blob_entity.rb @@ -15,3 +15,5 @@ class BlobEntity < Grape::Entity project_blob_path(request.project, File.join(request.ref, blob.path)) end end + +BlobEntity.prepend_if_ee('EE::BlobEntity') diff --git a/app/serializers/board_simple_entity.rb b/app/serializers/board_simple_entity.rb index 029d3808e75..a3c16a0b5c7 100644 --- a/app/serializers/board_simple_entity.rb +++ b/app/serializers/board_simple_entity.rb @@ -4,3 +4,5 @@ class BoardSimpleEntity < Grape::Entity expose :id expose :name end + +BoardSimpleEntity.prepend_if_ee('EE::BoardSimpleEntity') diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index 67e44ee9d10..0c754157267 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class BuildDetailsEntity < JobEntity + prepend_if_ee('::EE::BuildDetailEntity') # rubocop: disable Cop/InjectEnterpriseEditionModule + expose :coverage, :erased_at, :duration expose :tag_list, as: :tags expose :has_trace?, as: :has_trace diff --git a/app/serializers/cluster_basic_entity.rb b/app/serializers/cluster_basic_entity.rb new file mode 100644 index 00000000000..d104f2c8bbd --- /dev/null +++ b/app/serializers/cluster_basic_entity.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class ClusterBasicEntity < Grape::Entity + include RequestAwareEntity + + expose :name + expose :path, if: -> (cluster) { can?(request.current_user, :read_cluster, cluster) } do |cluster| + cluster.present(current_user: request.current_user).show_path + end +end diff --git a/app/serializers/current_board_entity.rb b/app/serializers/current_board_entity.rb index 371151532f8..f9d6691dc84 100644 --- a/app/serializers/current_board_entity.rb +++ b/app/serializers/current_board_entity.rb @@ -4,3 +4,5 @@ class CurrentBoardEntity < Grape::Entity expose :id expose :name end + +CurrentBoardEntity.prepend_if_ee('EE::CurrentBoardEntity') diff --git a/app/serializers/deployment_entity.rb b/app/serializers/deployment_entity.rb index 94a827658f0..e6421315b34 100644 --- a/app/serializers/deployment_entity.rb +++ b/app/serializers/deployment_entity.rb @@ -38,6 +38,8 @@ class DeploymentEntity < Grape::Entity expose :manual_actions, using: JobEntity, if: -> (*) { include_details? && can_create_deployment? } expose :scheduled_actions, using: JobEntity, if: -> (*) { include_details? && can_create_deployment? } + expose :cluster, using: ClusterBasicEntity + private def include_details? diff --git a/app/serializers/discussion_serializer.rb b/app/serializers/discussion_serializer.rb index 8bb7e93c033..7e7148b046e 100644 --- a/app/serializers/discussion_serializer.rb +++ b/app/serializers/discussion_serializer.rb @@ -17,3 +17,5 @@ class DiscussionSerializer < BaseSerializer opts.merge(additional_opts) end end + +DiscussionSerializer.prepend_if_ee('EE::DiscussionSerializer') diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index 8258135da4e..bffd9de4978 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -66,3 +66,5 @@ class EnvironmentEntity < Grape::Entity deployment_platform.cluster end end + +EnvironmentEntity.prepend_if_ee('::EE::EnvironmentEntity') diff --git a/app/serializers/issuable_sidebar_basic_entity.rb b/app/serializers/issuable_sidebar_basic_entity.rb index 058c707ef9d..498cfe5930d 100644 --- a/app/serializers/issuable_sidebar_basic_entity.rb +++ b/app/serializers/issuable_sidebar_basic_entity.rb @@ -109,3 +109,5 @@ class IssuableSidebarBasicEntity < Grape::Entity request.current_user end end + +IssuableSidebarBasicEntity.prepend_if_ee('EE::IssuableSidebarBasicEntity') diff --git a/app/serializers/issue_board_entity.rb b/app/serializers/issue_board_entity.rb index 2e1d7fb3f87..b8f799a7456 100644 --- a/app/serializers/issue_board_entity.rb +++ b/app/serializers/issue_board_entity.rb @@ -50,3 +50,5 @@ class IssueBoardEntity < Grape::Entity project_labels_path(issue.project, format: :json, include_ancestor_groups: true) end end + +IssueBoardEntity.prepend_if_ee('EE::IssueBoardEntity') diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index 82139855760..a3d0298a495 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -2,6 +2,7 @@ class IssueEntity < IssuableEntity include TimeTrackableEntity + prepend_if_ee('::EE::IssueEntity') # rubocop: disable Cop/InjectEnterpriseEditionModule expose :state expose :milestone_id @@ -19,11 +20,17 @@ class IssueEntity < IssuableEntity expose :project_id expose :moved_to_id do |issue| - if issue.moved_to_id.present? && can?(request.current_user, :read_issue, issue.moved_to) + if issue.moved? && can?(request.current_user, :read_issue, issue.moved_to) issue.moved_to_id end end + expose :duplicated_to_id do |issue| + if issue.duplicated? && can?(request.current_user, :read_issue, issue.duplicated_to) + issue.duplicated_to_id + end + end + expose :web_url do |issue| project_issue_path(issue.project, issue) end diff --git a/app/serializers/issue_sidebar_basic_entity.rb b/app/serializers/issue_sidebar_basic_entity.rb index 723875809ec..165dc462cfe 100644 --- a/app/serializers/issue_sidebar_basic_entity.rb +++ b/app/serializers/issue_sidebar_basic_entity.rb @@ -4,3 +4,5 @@ class IssueSidebarBasicEntity < IssuableSidebarBasicEntity expose :due_date expose :confidential end + +IssueSidebarBasicEntity.prepend_if_ee('EE::IssueSidebarBasicEntity') diff --git a/app/serializers/issue_sidebar_extras_entity.rb b/app/serializers/issue_sidebar_extras_entity.rb index dee891a50b7..ea2a49baa41 100644 --- a/app/serializers/issue_sidebar_extras_entity.rb +++ b/app/serializers/issue_sidebar_extras_entity.rb @@ -2,3 +2,5 @@ class IssueSidebarExtrasEntity < IssuableSidebarExtrasEntity end + +IssueSidebarExtrasEntity.prepend_if_ee('EE::IssueSidebarExtrasEntity') diff --git a/app/serializers/merge_request_poll_widget_entity.rb b/app/serializers/merge_request_poll_widget_entity.rb index cd33ffa702a..854349e8507 100644 --- a/app/serializers/merge_request_poll_widget_entity.rb +++ b/app/serializers/merge_request_poll_widget_entity.rb @@ -130,3 +130,5 @@ class MergeRequestPollWidgetEntity < IssuableEntity @presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: current_user) # rubocop: disable CodeReuse/Presenter end end + +MergeRequestPollWidgetEntity.prepend_if_ee('EE::MergeRequestPollWidgetEntity') diff --git a/app/serializers/merge_request_widget_entity.rb b/app/serializers/merge_request_widget_entity.rb index 2f2c42a7387..eda7a36c2ee 100644 --- a/app/serializers/merge_request_widget_entity.rb +++ b/app/serializers/merge_request_widget_entity.rb @@ -79,3 +79,5 @@ class MergeRequestWidgetEntity < Grape::Entity @presenters[merge_request] ||= MergeRequestPresenter.new(merge_request, current_user: current_user) # rubocop: disable CodeReuse/Presenter end end + +MergeRequestWidgetEntity.prepend_if_ee('EE::MergeRequestWidgetEntity') diff --git a/app/serializers/pipeline_details_entity.rb b/app/serializers/pipeline_details_entity.rb index dfef4364965..808e87c3fcf 100644 --- a/app/serializers/pipeline_details_entity.rb +++ b/app/serializers/pipeline_details_entity.rb @@ -11,3 +11,5 @@ class PipelineDetailsEntity < PipelineEntity expose :scheduled_actions, using: BuildActionEntity end end + +PipelineDetailsEntity.prepend_if_ee('EE::PipelineDetailsEntity') diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb index 95d73c6422d..eaaeaf040a2 100644 --- a/app/serializers/pipeline_serializer.rb +++ b/app/serializers/pipeline_serializer.rb @@ -58,3 +58,5 @@ class PipelineSerializer < BaseSerializer ] end end + +PipelineSerializer.prepend_if_ee('EE::PipelineSerializer') diff --git a/app/serializers/project_mirror_entity.rb b/app/serializers/project_mirror_entity.rb index c13cc3276a7..2efd820d893 100644 --- a/app/serializers/project_mirror_entity.rb +++ b/app/serializers/project_mirror_entity.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class ProjectMirrorEntity < Grape::Entity + prepend_if_ee('::EE::ProjectMirrorEntity') # rubocop: disable Cop/InjectEnterpriseEditionModule + expose :id expose :remote_mirrors_attributes, using: RemoteMirrorEntity do |project| diff --git a/app/serializers/user_preference_entity.rb b/app/serializers/user_preference_entity.rb index b99f80424db..4a5dda1e364 100644 --- a/app/serializers/user_preference_entity.rb +++ b/app/serializers/user_preference_entity.rb @@ -12,3 +12,5 @@ class UserPreferenceEntity < Grape::Entity UserPreference::NOTES_FILTERS[:all_notes] end end + +UserPreferenceEntity.prepend_if_ee('EE::UserPreferenceEntity') diff --git a/app/services/application_settings/update_service.rb b/app/services/application_settings/update_service.rb index e06a87c4763..6400b182715 100644 --- a/app/services/application_settings/update_service.rb +++ b/app/services/application_settings/update_service.rb @@ -78,3 +78,5 @@ module ApplicationSettings end end end + +ApplicationSettings::UpdateService.prepend_if_ee('EE::ApplicationSettings::UpdateService') diff --git a/app/services/applications/create_service.rb b/app/services/applications/create_service.rb index dff0d9696f8..d71174d1393 100644 --- a/app/services/applications/create_service.rb +++ b/app/services/applications/create_service.rb @@ -15,3 +15,5 @@ module Applications end end end + +Applications::CreateService.prepend_if_ee('EE::Applications::CreateService') diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index 22ade0b0658..40761ee97d2 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -47,3 +47,5 @@ class AuditEventService SecurityEvent.create(base_payload.merge(details: @details)) end end + +AuditEventService.prepend_if_ee('EE::AuditEventService') diff --git a/app/services/auto_merge_service.rb b/app/services/auto_merge_service.rb index 053c6d71fbb..eee227be202 100644 --- a/app/services/auto_merge_service.rb +++ b/app/services/auto_merge_service.rb @@ -60,3 +60,5 @@ class AutoMergeService < BaseService self.class.get_service_class(strategy)&.new(project, current_user, params) end end + +AutoMergeService.prepend_if_ee('EE::AutoMergeService') diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb index cfad2dd9265..2936bdae16e 100644 --- a/app/services/base_count_service.rb +++ b/app/services/base_count_service.rb @@ -48,3 +48,5 @@ class BaseCountService Rails.cache.write(key, block_given? ? yield : uncached_count, raw: raw?) end end + +BaseCountService.prepend_if_ee('EE::BaseCountService') diff --git a/app/services/boards/base_service.rb b/app/services/boards/base_service.rb index 205db47888e..439a5c06223 100644 --- a/app/services/boards/base_service.rb +++ b/app/services/boards/base_service.rb @@ -10,3 +10,5 @@ module Boards end end end + +Boards::BaseService.prepend_if_ee('EE::Boards::BaseService') diff --git a/app/services/boards/create_service.rb b/app/services/boards/create_service.rb index dd9358913fd..1a5dc790c41 100644 --- a/app/services/boards/create_service.rb +++ b/app/services/boards/create_service.rb @@ -24,3 +24,5 @@ module Boards end end end + +Boards::CreateService.prepend_if_ee('EE::Boards::CreateService') diff --git a/app/services/boards/issues/create_service.rb b/app/services/boards/issues/create_service.rb index bd045e18b8d..1769966a049 100644 --- a/app/services/boards/issues/create_service.rb +++ b/app/services/boards/issues/create_service.rb @@ -35,3 +35,5 @@ module Boards end end end + +Boards::Issues::CreateService.prepend_if_ee('EE::Boards::Issues::CreateService') diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index 0b69661bbd0..10eb1141f59 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -110,3 +110,5 @@ module Boards end end end + +Boards::Issues::ListService.prepend_if_ee('EE::Boards::Issues::ListService') diff --git a/app/services/boards/issues/move_service.rb b/app/services/boards/issues/move_service.rb index 00ce27db7c8..9e3c84d03ec 100644 --- a/app/services/boards/issues/move_service.rb +++ b/app/services/boards/issues/move_service.rb @@ -137,3 +137,5 @@ module Boards end end end + +Boards::Issues::MoveService.prepend_if_ee('EE::Boards::Issues::MoveService') diff --git a/app/services/boards/list_service.rb b/app/services/boards/list_service.rb index edd1cc7c2e1..44d5a21b15f 100644 --- a/app/services/boards/list_service.rb +++ b/app/services/boards/list_service.rb @@ -18,3 +18,5 @@ module Boards end end end + +Boards::ListService.prepend_if_ee('EE::Boards::ListService') diff --git a/app/services/boards/lists/create_service.rb b/app/services/boards/lists/create_service.rb index 48d2d5abaec..eb417ac4f5f 100644 --- a/app/services/boards/lists/create_service.rb +++ b/app/services/boards/lists/create_service.rb @@ -48,3 +48,5 @@ module Boards end end end + +Boards::Lists::CreateService.prepend_if_ee('EE::Boards::Lists::CreateService') diff --git a/app/services/boards/lists/list_service.rb b/app/services/boards/lists/list_service.rb index 1f20ec8df9e..3609d9c6283 100644 --- a/app/services/boards/lists/list_service.rb +++ b/app/services/boards/lists/list_service.rb @@ -11,3 +11,5 @@ module Boards end end end + +Boards::Lists::ListService.prepend_if_ee('EE::Boards::Lists::ListService') diff --git a/app/services/boards/update_service.rb b/app/services/boards/update_service.rb index 88aced01ccd..0340836fd78 100644 --- a/app/services/boards/update_service.rb +++ b/app/services/boards/update_service.rb @@ -7,3 +7,5 @@ module Boards end end end + +Boards::UpdateService.prepend_if_ee('EE::Boards::UpdateService') diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index d34cafce563..539576147f3 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -133,3 +133,5 @@ module Ci end end end + +Ci::CreatePipelineService.prepend_if_ee('EE::Ci::CreatePipelineService') diff --git a/app/services/ci/expire_pipeline_cache_service.rb b/app/services/ci/expire_pipeline_cache_service.rb index d8d38128af6..32abd1a7626 100644 --- a/app/services/ci/expire_pipeline_cache_service.rb +++ b/app/services/ci/expire_pipeline_cache_service.rb @@ -60,3 +60,5 @@ module Ci end end end + +Ci::ExpirePipelineCacheService.prepend_if_ee('EE::Ci::ExpirePipelineCacheService') diff --git a/app/services/ci/pipeline_trigger_service.rb b/app/services/ci/pipeline_trigger_service.rb index 2dbb7c3917d..0e99f142492 100644 --- a/app/services/ci/pipeline_trigger_service.rb +++ b/app/services/ci/pipeline_trigger_service.rb @@ -52,3 +52,5 @@ module Ci end end end + +Ci::PipelineTriggerService.prepend_if_ee('EE::Ci::PipelineTriggerService') diff --git a/app/services/ci/process_build_service.rb b/app/services/ci/process_build_service.rb index d9f8e7cb452..eb92c7d1a27 100644 --- a/app/services/ci/process_build_service.rb +++ b/app/services/ci/process_build_service.rb @@ -43,3 +43,5 @@ module Ci end end end + +Ci::ProcessBuildService.prepend_if_ee('EE::Ci::ProcessBuildService') diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 21055ad6617..d8f32ff88ce 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -182,3 +182,5 @@ module Ci end end end + +Ci::RegisterJobService.prepend_if_ee('EE::Ci::RegisterJobService') diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb index bbbeb4b30e4..5c26c611e00 100644 --- a/app/services/clusters/create_service.rb +++ b/app/services/clusters/create_service.rb @@ -59,3 +59,5 @@ module Clusters end end end + +Clusters::CreateService.prepend_if_ee('EE::Clusters::CreateService') diff --git a/app/services/commits/create_service.rb b/app/services/commits/create_service.rb index f3be68f9602..b5401a8ea37 100644 --- a/app/services/commits/create_service.rb +++ b/app/services/commits/create_service.rb @@ -100,3 +100,5 @@ module Commits end end end + +Commits::CreateService.prepend_if_ee('EE::Commits::CreateService') diff --git a/app/services/deploy_keys/create_service.rb b/app/services/deploy_keys/create_service.rb index 0c935285657..2dac94c7ade 100644 --- a/app/services/deploy_keys/create_service.rb +++ b/app/services/deploy_keys/create_service.rb @@ -7,3 +7,5 @@ module DeployKeys end end end + +DeployKeys::CreateService.prepend_if_ee('::EE::DeployKeys::CreateService') diff --git a/app/services/emails/create_service.rb b/app/services/emails/create_service.rb index dc06a5caa40..473256d9c6f 100644 --- a/app/services/emails/create_service.rb +++ b/app/services/emails/create_service.rb @@ -11,3 +11,5 @@ module Emails end end end + +Emails::CreateService.prepend_if_ee('EE::Emails::CreateService') diff --git a/app/services/emails/destroy_service.rb b/app/services/emails/destroy_service.rb index 9ca1a03e172..a0b43ad3d08 100644 --- a/app/services/emails/destroy_service.rb +++ b/app/services/emails/destroy_service.rb @@ -17,3 +17,5 @@ module Emails end end end + +Emails::DestroyService.prepend_if_ee('EE::Emails::DestroyService') diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb index 39266a6c961..395c5fe09ac 100644 --- a/app/services/event_create_service.rb +++ b/app/services/event_create_service.rb @@ -115,3 +115,5 @@ class EventCreateService Event.create!(attributes) end end + +EventCreateService.prepend_if_ee('EE::EventCreateService') diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb index d2b037a680c..9f9d12d6cf8 100644 --- a/app/services/git/branch_hooks_service.rb +++ b/app/services/git/branch_hooks_service.rb @@ -165,3 +165,5 @@ module Git end end end + +Git::BranchHooksService.prepend_if_ee('::EE::Git::BranchHooksService') diff --git a/app/services/git/branch_push_service.rb b/app/services/git/branch_push_service.rb index c4910180787..49c54e42b7c 100644 --- a/app/services/git/branch_push_service.rb +++ b/app/services/git/branch_push_service.rb @@ -90,3 +90,5 @@ module Git end end end + +Git::BranchPushService.prepend_if_ee('::EE::Git::BranchPushService') diff --git a/app/services/git/tag_hooks_service.rb b/app/services/git/tag_hooks_service.rb index 18eb780579f..e5b109c79d6 100644 --- a/app/services/git/tag_hooks_service.rb +++ b/app/services/git/tag_hooks_service.rb @@ -34,3 +34,5 @@ module Git end end end + +Git::TagHooksService.prepend_if_ee('::EE::Git::TagHooksService') diff --git a/app/services/git/wiki_push_service.rb b/app/services/git/wiki_push_service.rb index a053f133016..d4267d4a3c5 100644 --- a/app/services/git/wiki_push_service.rb +++ b/app/services/git/wiki_push_service.rb @@ -7,3 +7,5 @@ module Git end end end + +Git::WikiPushService.prepend_if_ee('EE::Git::WikiPushService') diff --git a/app/services/groups/create_service.rb b/app/services/groups/create_service.rb index 1dd22d7a3ae..61bd50616b8 100644 --- a/app/services/groups/create_service.rb +++ b/app/services/groups/create_service.rb @@ -70,3 +70,5 @@ module Groups end end end + +Groups::CreateService.prepend_if_ee('EE::Groups::CreateService') diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb index 9e00cbbbc55..c9c6b54a791 100644 --- a/app/services/groups/destroy_service.rb +++ b/app/services/groups/destroy_service.rb @@ -34,3 +34,5 @@ module Groups # rubocop: enable CodeReuse/ActiveRecord end end + +Groups::DestroyService.prepend_if_ee('EE::Groups::DestroyService') diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index 116756bacfe..534de601e20 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -66,3 +66,5 @@ module Groups end end end + +Groups::UpdateService.prepend_if_ee('EE::Groups::UpdateService') diff --git a/app/services/import/github_service.rb b/app/services/import/github_service.rb index a322a306ba4..3c57fada677 100644 --- a/app/services/import/github_service.rb +++ b/app/services/import/github_service.rb @@ -46,3 +46,5 @@ module Import end end end + +Import::GithubService.prepend_if_ee('EE::Import::GithubService') diff --git a/app/services/issuable/clone/base_service.rb b/app/services/issuable/clone/base_service.rb index 42dd9c666f5..54576e82030 100644 --- a/app/services/issuable/clone/base_service.rb +++ b/app/services/issuable/clone/base_service.rb @@ -58,3 +58,5 @@ module Issuable end end end + +Issuable::Clone::BaseService.prepend_if_ee('EE::Issuable::Clone::BaseService') diff --git a/app/services/issuable/common_system_notes_service.rb b/app/services/issuable/common_system_notes_service.rb index 77f38f8882e..6329ba81e48 100644 --- a/app/services/issuable/common_system_notes_service.rb +++ b/app/services/issuable/common_system_notes_service.rb @@ -103,3 +103,5 @@ module Issuable end end end + +Issuable::CommonSystemNotesService.prepend_if_ee('EE::Issuable::CommonSystemNotesService') diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 900e5063621..3e17d75c02c 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -414,3 +414,5 @@ class IssuableBaseService < BaseService issuable.changes.keys != ["relative_position"] end end + +IssuableBaseService.prepend_if_ee('EE::IssuableBaseService') diff --git a/app/services/issues/build_service.rb b/app/services/issues/build_service.rb index 61615ac2058..daef468987e 100644 --- a/app/services/issues/build_service.rb +++ b/app/services/issues/build_service.rb @@ -77,3 +77,5 @@ module Issues end end end + +Issues::BuildService.prepend_if_ee('EE::Issues::BuildService') diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index 5793a15e1bc..8d1df0d87a7 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -49,3 +49,5 @@ module Issues end end end + +Issues::CreateService.prepend_if_ee('EE::Issues::CreateService') diff --git a/app/services/issues/duplicate_service.rb b/app/services/issues/duplicate_service.rb index 9b22f5e7914..82c226f601e 100644 --- a/app/services/issues/duplicate_service.rb +++ b/app/services/issues/duplicate_service.rb @@ -11,6 +11,7 @@ module Issues create_issue_canonical_note(canonical_issue, duplicate_issue) close_service.new(project, current_user, {}).execute(duplicate_issue) + duplicate_issue.update(duplicated_to: canonical_issue) end private diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index 334fadadb6f..2409396c1ac 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -64,3 +64,5 @@ module Issues end end end + +Issues::MoveService.prepend_if_ee('EE::Issues::MoveService') diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index c8f4412c9f2..dc3c363f650 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -148,3 +148,5 @@ module Issues end end end + +Issues::UpdateService.prepend_if_ee('EE::Issues::UpdateService') diff --git a/app/services/keys/create_service.rb b/app/services/keys/create_service.rb index d9fa69a88d7..32c4ab645df 100644 --- a/app/services/keys/create_service.rb +++ b/app/services/keys/create_service.rb @@ -9,3 +9,5 @@ module Keys end end end + +Keys::CreateService.prepend_if_ee('EE::Keys::CreateService') diff --git a/app/services/keys/destroy_service.rb b/app/services/keys/destroy_service.rb index 159455f80f3..4552c5cf9a2 100644 --- a/app/services/keys/destroy_service.rb +++ b/app/services/keys/destroy_service.rb @@ -12,3 +12,5 @@ module Keys end end end + +Keys::DestroyService.prepend_if_ee('EE::Keys::DestroyService') diff --git a/app/services/lfs/lock_file_service.rb b/app/services/lfs/lock_file_service.rb index c7730d24bdc..383a0d6b4e3 100644 --- a/app/services/lfs/lock_file_service.rb +++ b/app/services/lfs/lock_file_service.rb @@ -41,3 +41,5 @@ module Lfs end end end + +Lfs::LockFileService.prepend_if_ee('EE::Lfs::LockFileService') diff --git a/app/services/lfs/unlock_file_service.rb b/app/services/lfs/unlock_file_service.rb index a42916d86bb..ea5a67b727f 100644 --- a/app/services/lfs/unlock_file_service.rb +++ b/app/services/lfs/unlock_file_service.rb @@ -45,3 +45,5 @@ module Lfs # rubocop: enable CodeReuse/ActiveRecord end end + +Lfs::UnlockFileService.prepend_if_ee('EE::Lfs::UnlockFileService') diff --git a/app/services/members/approve_access_request_service.rb b/app/services/members/approve_access_request_service.rb index 52b890d1821..e79c5f69a30 100644 --- a/app/services/members/approve_access_request_service.rb +++ b/app/services/members/approve_access_request_service.rb @@ -20,3 +20,5 @@ module Members end end end + +Members::ApproveAccessRequestService.prepend_if_ee('EE::Members::ApproveAccessRequestService') diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb index d6b17ec10be..0b729981a93 100644 --- a/app/services/members/create_service.rb +++ b/app/services/members/create_service.rb @@ -52,3 +52,5 @@ module Members end end end + +Members::CreateService.prepend_if_ee('EE::Members::CreateService') diff --git a/app/services/members/destroy_service.rb b/app/services/members/destroy_service.rb index 0164760920f..20f64a99ad7 100644 --- a/app/services/members/destroy_service.rb +++ b/app/services/members/destroy_service.rb @@ -66,3 +66,5 @@ module Members end end end + +Members::DestroyService.prepend_if_ee('EE::Members::DestroyService') diff --git a/app/services/members/update_service.rb b/app/services/members/update_service.rb index ff8d5c1d8c9..fdd2c62a452 100644 --- a/app/services/members/update_service.rb +++ b/app/services/members/update_service.rb @@ -25,3 +25,5 @@ module Members end end end + +Members::UpdateService.prepend_if_ee('EE::Members::UpdateService') diff --git a/app/services/merge_request_metrics_service.rb b/app/services/merge_request_metrics_service.rb index 4e88b77c855..9ea71838011 100644 --- a/app/services/merge_request_metrics_service.rb +++ b/app/services/merge_request_metrics_service.rb @@ -19,3 +19,5 @@ class MergeRequestMetricsService update!(latest_closed_by_id: nil, latest_closed_at: nil) end end + +MergeRequestMetricsService.prepend_if_ee('EE::MergeRequestMetricsService') diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index c6aae4c28f2..7d4227e4a41 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -90,3 +90,5 @@ module MergeRequests end end end + +MergeRequests::BaseService.prepend_if_ee('EE::MergeRequests::BaseService') diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index 88ed0c3ef4c..9cd6f3959fd 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -264,3 +264,5 @@ module MergeRequests end end end + +MergeRequests::BuildService.prepend_if_ee('EE::MergeRequests::BuildService') diff --git a/app/services/merge_requests/create_pipeline_service.rb b/app/services/merge_requests/create_pipeline_service.rb index 03246cc1920..9eb11820f7a 100644 --- a/app/services/merge_requests/create_pipeline_service.rb +++ b/app/services/merge_requests/create_pipeline_service.rb @@ -35,3 +35,5 @@ module MergeRequests end end end + +MergeRequests::CreatePipelineService.prepend_if_ee('EE::MergeRequests::CreatePipelineService') diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb index a69678a4422..1c730232abb 100644 --- a/app/services/merge_requests/create_service.rb +++ b/app/services/merge_requests/create_service.rb @@ -67,3 +67,5 @@ module MergeRequests end end end + +MergeRequests::CreateService.include_if_ee('EE::MergeRequests::CreateService') diff --git a/app/services/merge_requests/merge_base_service.rb b/app/services/merge_requests/merge_base_service.rb index 1ed396cee1e..3f7f8bcdcbf 100644 --- a/app/services/merge_requests/merge_base_service.rb +++ b/app/services/merge_requests/merge_base_service.rb @@ -72,3 +72,5 @@ module MergeRequests end end end + +MergeRequests::MergeBaseService.prepend_if_ee('EE::MergeRequests::MergeBaseService') diff --git a/app/services/merge_requests/post_merge_service.rb b/app/services/merge_requests/post_merge_service.rb index c13f7dd5088..fbe6c48ac28 100644 --- a/app/services/merge_requests/post_merge_service.rb +++ b/app/services/merge_requests/post_merge_service.rb @@ -53,3 +53,5 @@ module MergeRequests end end end + +MergeRequests::PostMergeService.prepend_if_ee('EE::MergeRequests::PostMergeService') diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 8961d2e1023..f54642d7bd9 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -257,3 +257,5 @@ module MergeRequests end end end + +MergeRequests::RefreshService.prepend_if_ee('EE::MergeRequests::RefreshService') diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index d361e96babf..4acc3f1981a 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -130,3 +130,5 @@ module MergeRequests end end end + +MergeRequests::UpdateService.prepend_if_ee('EE::MergeRequests::UpdateService') diff --git a/app/services/milestones/promote_service.rb b/app/services/milestones/promote_service.rb index 0fe67067eb5..80e6456f729 100644 --- a/app/services/milestones/promote_service.rb +++ b/app/services/milestones/promote_service.rb @@ -89,3 +89,5 @@ module Milestones end end end + +Milestones::PromoteService.prepend_if_ee('EE::Milestones::PromoteService') diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb index 01ab8b37bac..c445c816554 100644 --- a/app/services/milestones/update_service.rb +++ b/app/services/milestones/update_service.rb @@ -22,3 +22,5 @@ module Milestones # rubocop: enable CodeReuse/ActiveRecord end end + +Milestones::UpdateService.prepend_if_ee('EE::Milestones::UpdateService') diff --git a/app/services/notes/quick_actions_service.rb b/app/services/notes/quick_actions_service.rb index 0852a708240..076df10bf6f 100644 --- a/app/services/notes/quick_actions_service.rb +++ b/app/services/notes/quick_actions_service.rb @@ -54,3 +54,5 @@ module Notes end end end + +Notes::QuickActionsService.prepend_if_ee('EE::Notes::QuickActionsService') diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index ca3f0b73096..fca64270cae 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -400,3 +400,6 @@ module NotificationRecipientService end end end + +NotificationRecipientService::Builder::Default.prepend_if_ee('EE::NotificationRecipientBuilders::Default') # rubocop: disable Cop/InjectEnterpriseEditionModule +NotificationRecipientService.prepend_if_ee('EE::NotificationRecipientService') diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index a4243b7bc5e..ed357aa0392 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -622,3 +622,5 @@ class NotificationService source.respond_to?(:group) && source.group end end + +NotificationService.prepend_if_ee('EE::NotificationService') diff --git a/app/services/projects/after_rename_service.rb b/app/services/projects/after_rename_service.rb index fafdecb3222..2a35a07d555 100644 --- a/app/services/projects/after_rename_service.rb +++ b/app/services/projects/after_rename_service.rb @@ -139,3 +139,5 @@ module Projects end end end + +Projects::AfterRenameService.prepend_if_ee('EE::Projects::AfterRenameService') diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb index 3dad90188cf..53bd954eab6 100644 --- a/app/services/projects/autocomplete_service.rb +++ b/app/services/projects/autocomplete_service.rb @@ -38,3 +38,5 @@ module Projects end end end + +Projects::AutocompleteService.prepend_if_ee('EE::Projects::AutocompleteService') diff --git a/app/services/projects/cleanup_service.rb b/app/services/projects/cleanup_service.rb index 5972bfd4071..9b4114ff42f 100644 --- a/app/services/projects/cleanup_service.rb +++ b/app/services/projects/cleanup_service.rb @@ -89,3 +89,5 @@ module Projects end end end + +Projects::CleanupService.prepend_if_ee('EE::Projects::CleanupService') diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb index 678bc0d24c3..31977a7c76a 100644 --- a/app/services/projects/create_from_template_service.rb +++ b/app/services/projects/create_from_template_service.rb @@ -26,3 +26,5 @@ module Projects end end end + +Projects::CreateFromTemplateService.prepend_if_ee('EE::Projects::CreateFromTemplateService') diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 942a45286b2..728eb039b54 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -199,3 +199,5 @@ module Projects end end end + +Projects::CreateService.prepend_if_ee('EE::Projects::CreateService') diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index 108c4a79cde..5fdf98c3c5e 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -228,3 +228,5 @@ module Projects end end end + +Projects::DestroyService.prepend_if_ee('EE::Projects::DestroyService') diff --git a/app/services/projects/disable_deploy_key_service.rb b/app/services/projects/disable_deploy_key_service.rb index e483c0708c4..9fb2e3398b2 100644 --- a/app/services/projects/disable_deploy_key_service.rb +++ b/app/services/projects/disable_deploy_key_service.rb @@ -11,3 +11,5 @@ module Projects end end end + +Projects::DisableDeployKeyService.prepend_if_ee('EE::Projects::DisableDeployKeyService') diff --git a/app/services/projects/enable_deploy_key_service.rb b/app/services/projects/enable_deploy_key_service.rb index 38219cacee9..0a24137bd61 100644 --- a/app/services/projects/enable_deploy_key_service.rb +++ b/app/services/projects/enable_deploy_key_service.rb @@ -26,3 +26,5 @@ module Projects end end end + +Projects::EnableDeployKeyService.prepend_if_ee('EE::Projects::EnableDeployKeyService') diff --git a/app/services/projects/gitlab_projects_import_service.rb b/app/services/projects/gitlab_projects_import_service.rb index a315adf42f0..234ebbc6651 100644 --- a/app/services/projects/gitlab_projects_import_service.rb +++ b/app/services/projects/gitlab_projects_import_service.rb @@ -69,3 +69,5 @@ module Projects end end end + +Projects::GitlabProjectsImportService.prepend_if_ee('EE::Projects::GitlabProjectsImportService') diff --git a/app/services/projects/group_links/create_service.rb b/app/services/projects/group_links/create_service.rb index e3d5bea0852..241948b335b 100644 --- a/app/services/projects/group_links/create_service.rb +++ b/app/services/projects/group_links/create_service.rb @@ -21,3 +21,5 @@ module Projects end end end + +Projects::GroupLinks::CreateService.prepend_if_ee('EE::Projects::GroupLinks::CreateService') diff --git a/app/services/projects/group_links/destroy_service.rb b/app/services/projects/group_links/destroy_service.rb index 8aefad048ce..c96dcaae8d5 100644 --- a/app/services/projects/group_links/destroy_service.rb +++ b/app/services/projects/group_links/destroy_service.rb @@ -11,3 +11,5 @@ module Projects end end end + +Projects::GroupLinks::DestroyService.prepend_if_ee('EE::Projects::GroupLinks::DestroyService') diff --git a/app/services/projects/hashed_storage/migrate_attachments_service.rb b/app/services/projects/hashed_storage/migrate_attachments_service.rb index affe6e5668d..0cbff283102 100644 --- a/app/services/projects/hashed_storage/migrate_attachments_service.rb +++ b/app/services/projects/hashed_storage/migrate_attachments_service.rb @@ -37,3 +37,5 @@ module Projects end end end + +Projects::HashedStorage::MigrateAttachmentsService.prepend_if_ee('EE::Projects::HashedStorage::MigrateAttachmentsService') diff --git a/app/services/projects/hashed_storage/migrate_repository_service.rb b/app/services/projects/hashed_storage/migrate_repository_service.rb index e8393128d58..e248a13c702 100644 --- a/app/services/projects/hashed_storage/migrate_repository_service.rb +++ b/app/services/projects/hashed_storage/migrate_repository_service.rb @@ -38,3 +38,5 @@ module Projects end end end + +Projects::HashedStorage::MigrateRepositoryService.prepend_if_ee('EE::Projects::HashedStorage::MigrateRepositoryService') diff --git a/app/services/projects/operations/update_service.rb b/app/services/projects/operations/update_service.rb index 48eddb0e8d0..dd72c2844c2 100644 --- a/app/services/projects/operations/update_service.rb +++ b/app/services/projects/operations/update_service.rb @@ -47,3 +47,5 @@ module Projects end end end + +Projects::Operations::UpdateService.prepend_if_ee('::EE::Projects::Operations::UpdateService') diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index 078a751025f..4b3aca58dd7 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -168,3 +168,5 @@ module Projects end end end + +Projects::TransferService.prepend_if_ee('EE::Projects::TransferService') diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb index 8acbdc7e02b..51a6f62e597 100644 --- a/app/services/projects/update_service.rb +++ b/app/services/projects/update_service.rb @@ -139,3 +139,5 @@ module Projects end end end + +Projects::UpdateService.prepend_if_ee('EE::Projects::UpdateService') diff --git a/app/services/protected_branches/access_level_params.rb b/app/services/protected_branches/access_level_params.rb index a7ef573ff0b..e34bc23b4dc 100644 --- a/app/services/protected_branches/access_level_params.rb +++ b/app/services/protected_branches/access_level_params.rb @@ -33,3 +33,5 @@ module ProtectedBranches end end end + +ProtectedBranches::AccessLevelParams.prepend_if_ee('EE::ProtectedBranches::AccessLevelParams') diff --git a/app/services/protected_branches/api_service.rb b/app/services/protected_branches/api_service.rb index 1b13dace5f2..ac4917d6590 100644 --- a/app/services/protected_branches/api_service.rb +++ b/app/services/protected_branches/api_service.rb @@ -15,3 +15,5 @@ module ProtectedBranches end end end + +ProtectedBranches::ApiService.prepend_if_ee('EE::ProtectedBranches::ApiService') diff --git a/app/services/protected_branches/create_service.rb b/app/services/protected_branches/create_service.rb index 6b2836bba39..3c86d7d087d 100644 --- a/app/services/protected_branches/create_service.rb +++ b/app/services/protected_branches/create_service.rb @@ -25,3 +25,5 @@ module ProtectedBranches end end end + +ProtectedBranches::CreateService.prepend_if_ee('EE::ProtectedBranches::CreateService') diff --git a/app/services/protected_branches/legacy_api_update_service.rb b/app/services/protected_branches/legacy_api_update_service.rb index 7cb8d41818f..65dc3297ae8 100644 --- a/app/services/protected_branches/legacy_api_update_service.rb +++ b/app/services/protected_branches/legacy_api_update_service.rb @@ -48,3 +48,5 @@ module ProtectedBranches end end end + +ProtectedBranches::LegacyApiUpdateService.prepend_if_ee('EE::ProtectedBranches::LegacyApiUpdateService') diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index e0924608a6d..a14e0515a1f 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -177,3 +177,5 @@ module QuickActions # rubocop: enable CodeReuse/ActiveRecord end end + +QuickActions::InterpretService.prepend_if_ee('EE::QuickActions::InterpretService') diff --git a/app/services/resource_events/change_labels_service.rb b/app/services/resource_events/change_labels_service.rb index b45e567079b..e0d019f54be 100644 --- a/app/services/resource_events/change_labels_service.rb +++ b/app/services/resource_events/change_labels_service.rb @@ -40,3 +40,5 @@ module ResourceEvents end end end + +ResourceEvents::ChangeLabelsService.prepend_if_ee('EE::ResourceEvents::ChangeLabelsService') diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb index 18a90c952fa..c841cbfaa00 100644 --- a/app/services/search/global_service.rb +++ b/app/services/search/global_service.rb @@ -35,3 +35,5 @@ module Search end end end + +Search::GlobalService.prepend_if_ee('EE::Search::GlobalService') diff --git a/app/services/search/group_service.rb b/app/services/search/group_service.rb index 6f3b5f00b86..4dbd9eb14bb 100644 --- a/app/services/search/group_service.rb +++ b/app/services/search/group_service.rb @@ -25,3 +25,5 @@ module Search end end end + +Search::GroupService.prepend_if_ee('EE::Search::GroupService') diff --git a/app/services/search/project_service.rb b/app/services/search/project_service.rb index 32d5cd7ddb2..17a322c2665 100644 --- a/app/services/search/project_service.rb +++ b/app/services/search/project_service.rb @@ -25,3 +25,5 @@ module Search end end end + +Search::ProjectService.prepend_if_ee('EE::Search::ProjectService') diff --git a/app/services/search/snippet_service.rb b/app/services/search/snippet_service.rb index e899a36f468..7c6c6878400 100644 --- a/app/services/search/snippet_service.rb +++ b/app/services/search/snippet_service.rb @@ -19,3 +19,5 @@ module Search end end end + +Search::SnippetService.prepend_if_ee('::EE::Search::SnippetService') diff --git a/app/services/search_service.rb b/app/services/search_service.rb index e0cbfac2420..91c0f9ba104 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -69,3 +69,5 @@ class SearchService attr_reader :current_user, :params end + +SearchService.prepend_if_ee('EE::SearchService') diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index 34260d12a62..06d2037fb63 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -150,3 +150,5 @@ class SystemHooksService } end end + +SystemHooksService.prepend_if_ee('EE::SystemHooksService') diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 1b48b20e28b..ad8acb26a2d 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -706,3 +706,5 @@ module SystemNoteService ActionController::Base.helpers.content_tag(*args) end end + +SystemNoteService.prepend_if_ee('EE::SystemNoteService') diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index b1256df35d6..b1b0fb641df 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -333,3 +333,5 @@ class TodoService PendingTodosFinder.new(user, criteria).execute end end + +TodoService.prepend_if_ee('EE::TodoService') diff --git a/app/services/update_deployment_service.rb b/app/services/update_deployment_service.rb index dcafebae52d..730210c611a 100644 --- a/app/services/update_deployment_service.rb +++ b/app/services/update_deployment_service.rb @@ -53,3 +53,5 @@ class UpdateDeploymentService environment_options[:action] || 'start' end end + +UpdateDeploymentService.prepend_if_ee('EE::UpdateDeploymentService') diff --git a/app/services/user_project_access_changed_service.rb b/app/services/user_project_access_changed_service.rb index adca43660e8..21b52944800 100644 --- a/app/services/user_project_access_changed_service.rb +++ b/app/services/user_project_access_changed_service.rb @@ -15,3 +15,5 @@ class UserProjectAccessChangedService end end end + +UserProjectAccessChangedService.prepend_if_ee('EE::UserProjectAccessChangedService') diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb index 026bcfcdaf4..8c85ad9ffd8 100644 --- a/app/services/users/build_service.rb +++ b/app/services/users/build_service.rb @@ -125,3 +125,5 @@ module Users end end end + +Users::BuildService.prepend_if_ee('EE::Users::BuildService') diff --git a/app/services/users/destroy_service.rb b/app/services/users/destroy_service.rb index 73fa6089945..e341c7f0537 100644 --- a/app/services/users/destroy_service.rb +++ b/app/services/users/destroy_service.rb @@ -64,3 +64,5 @@ module Users end end end + +Users::DestroyService.prepend_if_ee('EE::Users::DestroyService') diff --git a/app/services/users/migrate_to_ghost_user_service.rb b/app/services/users/migrate_to_ghost_user_service.rb index a66b6627e40..e7186fdfb63 100644 --- a/app/services/users/migrate_to_ghost_user_service.rb +++ b/app/services/users/migrate_to_ghost_user_service.rb @@ -81,3 +81,5 @@ module Users end end end + +Users::MigrateToGhostUserService.prepend_if_ee('EE::Users::MigrateToGhostUserService') diff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rb index 8f52e9cb23f..eea5ff6e5db 100644 --- a/app/services/users/update_service.rb +++ b/app/services/users/update_service.rb @@ -80,3 +80,5 @@ module Users end end end + +Users::UpdateService.prepend_if_ee('EE::Users::UpdateService') diff --git a/app/services/wiki_pages/base_service.rb b/app/services/wiki_pages/base_service.rb index b9df690c2b7..82c15ffc9b9 100644 --- a/app/services/wiki_pages/base_service.rb +++ b/app/services/wiki_pages/base_service.rb @@ -17,3 +17,5 @@ module WikiPages end end end + +WikiPages::BaseService.prepend_if_ee('EE::WikiPages::BaseService') diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index 499807d1438..f99ad987156 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -137,6 +137,8 @@ module ObjectStorage included do |base| base.include(ObjectStorage) + include_if_ee('::EE::ObjectStorage::Concern') # rubocop: disable Cop/InjectEnterpriseEditionModule + after :migrate, :delete_migrated_file end diff --git a/app/views/clusters/clusters/show.html.haml b/app/views/clusters/clusters/show.html.haml index 6052e5d96f2..00fdd5e9562 100644 --- a/app/views/clusters/clusters/show.html.haml +++ b/app/views/clusters/clusters/show.html.haml @@ -16,6 +16,7 @@ install_jupyter_path: clusterable.install_applications_cluster_path(@cluster, :jupyter), install_knative_path: clusterable.install_applications_cluster_path(@cluster, :knative), update_knative_path: clusterable.update_applications_cluster_path(@cluster, :knative), + cluster_environments_path: clusterable.environments_cluster_path(@cluster), toggle_status: @cluster.enabled? ? 'true': 'false', has_rbac: has_rbac_enabled?(@cluster) ? 'true': 'false', cluster_type: @cluster.cluster_type, diff --git a/app/views/groups/group_members/_new_group_member.html.haml b/app/views/groups/group_members/_new_group_member.html.haml index 8b511f6866f..93dd8f48a60 100644 --- a/app/views/groups/group_members/_new_group_member.html.haml +++ b/app/views/groups/group_members/_new_group_member.html.haml @@ -19,4 +19,4 @@ On this date, the member(s) will automatically lose access to this group and all of its projects. .col-md-2 - = f.submit 'Add to group', class: "btn btn-success btn-block" + = f.submit 'Add to group', class: "btn btn-success btn-block", data: { qa_selector: 'add_to_group_button' } diff --git a/app/views/groups/settings/_general.html.haml b/app/views/groups/settings/_general.html.haml index db1849ebb45..73a0c8ff02b 100644 --- a/app/views/groups/settings/_general.html.haml +++ b/app/views/groups/settings/_general.html.haml @@ -6,7 +6,7 @@ .row .form-group.col-md-5 = f.label :name, _('Group name'), class: 'label-bold' - = f.text_field :name, class: 'form-control' + = f.text_field :name, class: 'form-control', data: { qa_selector: 'group_name_field' } .form-group.col-md-7 = f.label :id, _('Group ID'), class: 'label-bold' @@ -30,4 +30,4 @@ = render 'shared/visibility_level', f: f, visibility_level: @group.visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group - = f.submit _('Save changes'), class: 'btn btn-success mt-4 js-dirty-submit' + = f.submit _('Save changes'), class: 'btn btn-success mt-4 js-dirty-submit', data: { qa_selector: 'save_name_visibility_settings_button' } diff --git a/app/views/groups/settings/_lfs.html.haml b/app/views/groups/settings/_lfs.html.haml index 4674d561c12..66fdd1c11da 100644 --- a/app/views/groups/settings/_lfs.html.haml +++ b/app/views/groups/settings/_lfs.html.haml @@ -7,7 +7,7 @@ .form-group.append-bottom-default .form-check - = f.check_box :lfs_enabled, checked: @group.lfs_enabled?, class: 'form-check-input' + = f.check_box :lfs_enabled, checked: @group.lfs_enabled?, class: 'form-check-input', data: { qa_selector: 'lfs_checkbox' } = f.label :lfs_enabled, class: 'form-check-label' do %span = _('Allow projects within this group to use Git LFS') diff --git a/app/views/groups/settings/_project_creation_level.html.haml b/app/views/groups/settings/_project_creation_level.html.haml index 9f711e6aade..36b714535d2 100644 --- a/app/views/groups/settings/_project_creation_level.html.haml +++ b/app/views/groups/settings/_project_creation_level.html.haml @@ -1,3 +1,3 @@ .form-group = f.label s_('ProjectCreationLevel|Allowed to create projects'), class: 'label-bold' - = f.select :project_creation_level, options_for_select(::Gitlab::Access.project_creation_options, group.project_creation_level), {}, class: 'form-control' + = f.select :project_creation_level, options_for_select(::Gitlab::Access.project_creation_options, group.project_creation_level), {}, class: 'form-control', data: { qa_selector: 'project_creation_level_dropdown' } diff --git a/app/views/groups/settings/_two_factor_auth.html.haml b/app/views/groups/settings/_two_factor_auth.html.haml index 5d3f1cbb279..c49e61c8a31 100644 --- a/app/views/groups/settings/_two_factor_auth.html.haml +++ b/app/views/groups/settings/_two_factor_auth.html.haml @@ -7,7 +7,7 @@ .form-group .form-check - = f.check_box :require_two_factor_authentication, class: 'form-check-input' + = f.check_box :require_two_factor_authentication, class: 'form-check-input', data: { qa_selector: 'require_2fa_checkbox' } = f.label :require_two_factor_authentication, class: 'form-check-label' do %span= _('Require all users in this group to setup Two-factor authentication') .form-group diff --git a/app/views/projects/_export.html.haml b/app/views/projects/_export.html.haml index e42772c2dd9..f564ed41760 100644 --- a/app/views/projects/_export.html.haml +++ b/app/views/projects/_export.html.haml @@ -26,9 +26,9 @@ %p= _('Once the exported file is ready, you will receive a notification email with a download link, or you can download it from this page.') - if project.export_status == :finished = link_to _('Download export'), download_export_project_path(project), - rel: 'nofollow', download: '', method: :get, class: "btn btn-default" + rel: 'nofollow', download: '', method: :get, class: "btn btn-default", data: { qa_selector: 'download_export_link' } = link_to _('Generate new export'), generate_new_export_project_path(project), method: :post, class: "btn btn-default" - else = link_to _('Export project'), export_project_path(project), - method: :post, class: "btn btn-default" + method: :post, class: "btn btn-default", data: { qa_selector: 'export_project_link' } diff --git a/app/views/projects/buttons/_download.html.haml b/app/views/projects/buttons/_download.html.haml index 4762045ee96..96df3cd18fe 100644 --- a/app/views/projects/buttons/_download.html.haml +++ b/app/views/projects/buttons/_download.html.haml @@ -3,7 +3,7 @@ - if !project.empty_repo? && can?(current_user, :download_code, project) - archive_prefix = "#{project.path}-#{ref.tr('/', '-')}" .project-action-button.dropdown.inline> - %button.btn.has-tooltip{ title: s_('DownloadSource|Download'), 'data-toggle' => 'dropdown', 'aria-label' => s_('DownloadSource|Download'), 'data-display' => 'static' } + %button.btn.has-tooltip{ title: s_('DownloadSource|Download'), 'data-toggle' => 'dropdown', 'aria-label' => s_('DownloadSource|Download'), 'data-display' => 'static', data: { qa_selector: 'download_source_code_button' } } = sprite_icon('download') %span.sr-only= _('Select Archive Format') = sprite_icon("arrow-down") diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 763cc764144..b5e24cbbffb 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -10,7 +10,7 @@ %p= _('Update your project name, topics, description and avatar.') .settings-content= render 'projects/settings/general' -%section.settings.sharing-permissions.no-animate#js-shared-permissions{ class: ('expanded' if expanded) } +%section.settings.sharing-permissions.no-animate#js-shared-permissions{ class: ('expanded' if expanded), data: { qa_selector: 'visibility_features_permissions_content' } } .settings-header %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Visibility, project features, permissions') %button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand') @@ -21,7 +21,7 @@ %input{ name: 'update_section', type: 'hidden', value: 'js-shared-permissions' } %template.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data_json(@project) .js-project-permissions-form - = f.submit _('Save changes'), class: "btn btn-success" + = f.submit _('Save changes'), class: "btn btn-success", data: { qa_selector: 'visibility_features_permissions_save_button' } %section.qa-merge-request-settings.rspec-merge-request-settings.settings.merge-requests-feature.no-animate#js-merge-request-settings{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] } .settings-header @@ -81,12 +81,12 @@ - if @project.archived? %p= _("Unarchiving the project will restore people's ability to make changes to it. The repository can be committed to, and issues, comments and other entities can be created. <strong>Once active this project shows up in the search and on the dashboard.</strong>").html_safe = link_to _('Unarchive project'), unarchive_project_path(@project), - data: { confirm: _("Are you sure that you want to unarchive this project?") }, + data: { confirm: _("Are you sure that you want to unarchive this project?"), qa_selector: 'unarchive_project_link' }, method: :post, class: "btn btn-success" - else %p= _("Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. <strong>The repository cannot be committed to, and no issues, comments or other entities can be created.</strong>").html_safe = link_to _('Archive project'), archive_project_path(@project), - data: { confirm: _("Are you sure that you want to archive this project?") }, + data: { confirm: _("Are you sure that you want to archive this project?"), qa_selector: 'archive_project_link' }, method: :post, class: "btn btn-warning" .sub-section.rename-repository %h4.warning-title= _('Change path') diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 8ec07dc3bb4..1843ad7bb75 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -15,13 +15,7 @@ .issuable-status-box.status-box.status-box-issue-closed{ class: issue_button_visibility(@issue, false) } = sprite_icon('mobile-issue-close', size: 16, css_class: 'd-block d-sm-none') .d-none.d-sm-block - - if @issue.moved? && can?(current_user, :read_issue, @issue.moved_to) - - moved_link_start = "<a href=\"#{issue_path(@issue.moved_to)}\" class=\"text-white text-underline\">".html_safe - - moved_link_end = '</a>'.html_safe - = s_('IssuableStatus|Closed (%{moved_link_start}moved%{moved_link_end})').html_safe % {moved_link_start: moved_link_start, - moved_link_end: moved_link_end} - - else - = _("Closed") + = issue_closed_text(@issue, current_user) .issuable-status-box.status-box.status-box-open{ class: issue_button_visibility(@issue, true) } = sprite_icon('issue-open-m', size: 16, css_class: 'd-block d-sm-none') %span.d-none.d-sm-block Open diff --git a/app/views/projects/project_members/_new_project_group.html.haml b/app/views/projects/project_members/_new_project_group.html.haml index 079811e4e79..d413048ca10 100644 --- a/app/views/projects/project_members/_new_project_group.html.haml +++ b/app/views/projects/project_members/_new_project_group.html.haml @@ -3,7 +3,7 @@ = form_tag project_group_links_path(@project), class: 'js-requires-input', method: :post do .form-group = label_tag :link_group_id, _("Select a group to invite"), class: "label-bold" - = groups_select_tag(:link_group_id, data: { skip_groups: @skip_groups }, class: "input-clamp", required: true) + = groups_select_tag(:link_group_id, data: { skip_groups: @skip_groups }, class: "input-clamp qa-group-select-field", required: true) .form-group = label_tag :link_group_access, _("Max access level"), class: "label-bold" .select-wrapper @@ -18,4 +18,4 @@ .clearable-input = text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date-groups', placeholder: _('Expiration date'), id: 'expires_at_groups' %i.clear-icon.js-clear-input - = submit_tag _("Invite"), class: "btn btn-success" + = submit_tag _("Invite"), class: "btn btn-success", data: { qa_selector: 'invite_group_button' } diff --git a/app/views/projects/project_members/index.html.haml b/app/views/projects/project_members/index.html.haml index cc98ba64f08..24fe583a9b5 100644 --- a/app/views/projects/project_members/index.html.haml +++ b/app/views/projects/project_members/index.html.haml @@ -19,7 +19,7 @@ %li.nav-tab{ role: 'presentation' } %a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite member") %li.nav-tab{ role: 'presentation', class: ('active' if membership_locked?) } - %a.nav-link{ href: '#invite-group-pane', id: 'invite-group-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite group") + %a.nav-link{ href: '#invite-group-pane', id: 'invite-group-tab', data: { toggle: 'tab', qa_selector: 'invite_group_tab' }, role: 'tab' }= _("Invite group") .tab-content.gitlab-tab-content .tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' } diff --git a/app/views/shared/_allow_request_access.html.haml b/app/views/shared/_allow_request_access.html.haml index a50f1877d08..2b24bde9e59 100644 --- a/app/views/shared/_allow_request_access.html.haml +++ b/app/views/shared/_allow_request_access.html.haml @@ -1,7 +1,7 @@ - label_class = local_assigns.fetch(:bold_label, false) ? 'font-weight-bold' : '' .form-check - = form.check_box :request_access_enabled, class: 'form-check-input' + = form.check_box :request_access_enabled, class: 'form-check-input', data: { qa_selector: 'request_access_checkbox' } = form.label :request_access_enabled, class: 'form-check-label' do %span{ class: label_class }= _('Allow users to request access') %br diff --git a/app/views/shared/_visibility_radios.html.haml b/app/views/shared/_visibility_radios.html.haml index 82ffdc9cd13..80532c9187b 100644 --- a/app/views/shared/_visibility_radios.html.haml +++ b/app/views/shared/_visibility_radios.html.haml @@ -4,7 +4,7 @@ - next if disallowed || restricted .form-check - = form.radio_button model_method, level, checked: (selected_level == level), class: 'form-check-input', data: { track_label: "blank_project", track_event: "activate_form_input", track_property: "#{model_method}_#{level}", track_value: "" } + = form.radio_button model_method, level, checked: (selected_level == level), class: 'form-check-input', data: { track_label: "blank_project", track_event: "activate_form_input", track_property: "#{model_method}_#{level}", track_value: "", qa_selector: "#{visibility_level_label(level).downcase}_radio" } = form.label "#{model_method}_#{level}", class: 'form-check-label' do = visibility_level_icon(level) .option-title diff --git a/app/views/shared/members/_group.html.haml b/app/views/shared/members/_group.html.haml index 42a823e3a8d..18368ecc9ff 100644 --- a/app/views/shared/members/_group.html.haml +++ b/app/views/shared/members/_group.html.haml @@ -5,7 +5,7 @@ -# Note this is just for groups. For individual members please see shared/members/_member -%li.member.group_member.py-2.px-3.d-flex.flex-column.flex-md-row{ id: dom_id } +%li.member.group_member.py-2.px-3.d-flex.flex-column.flex-md-row{ id: dom_id, data: { qa_selector: 'group_row' } } %span.list-item-name.mb-2.m-md-0 = group_icon(group, class: "avatar s40 flex-shrink-0 flex-grow-0", alt: '') .user-info @@ -41,7 +41,7 @@ - if can_admin_member = link_to project_group_link_path(@project, group_link), method: :delete, - data: { confirm: _("Are you sure you want to remove %{group_name}?") % { group_name: group.name } }, + data: { confirm: _("Are you sure you want to remove %{group_name}?") % { group_name: group.name }, qa_selector: 'delete_group_access_link' }, class: 'btn btn-remove m-0 ml-sm-2 align-self-center' do %span.d-block.d-sm-none = _("Delete") diff --git a/app/views/shared/members/_member.html.haml b/app/views/shared/members/_member.html.haml index 6762f211a80..d5c1a1bee6d 100644 --- a/app/views/shared/members/_member.html.haml +++ b/app/views/shared/members/_member.html.haml @@ -8,7 +8,7 @@ -# Note this is just for individual members. For groups please see shared/members/_group -%li.member.py-2.px-3.d-flex.flex-column{ class: [dom_class(member), ("is-overridden" if override), ("flex-md-row" unless force_mobile_view)], id: dom_id(member) } +%li.member.py-2.px-3.d-flex.flex-column{ class: [dom_class(member), ("is-overridden" if override), ("flex-md-row" unless force_mobile_view)], id: dom_id(member), data: { qa_selector: 'member_row' } } %span.list-item-name.mb-2.m-md-0 - if user = image_tag avatar_icon_for_user(user, 40), class: "avatar s40 flex-shrink-0 flex-grow-0", alt: '' @@ -72,7 +72,7 @@ .member-form-control.dropdown{ class: [("mr-sm-2 d-sm-inline-block" unless force_mobile_view)] } %button.dropdown-menu-toggle.js-member-permissions-dropdown{ type: "button", disabled: member.can_override? && !override, - data: { toggle: "dropdown", field_name: "#{f.object_name}[access_level]" } } + data: { toggle: "dropdown", field_name: "#{f.object_name}[access_level]", qa_selector: "access_level_dropdown" } } %span.dropdown-toggle-text = member.human_access = icon("chevron-down") @@ -84,7 +84,7 @@ %li = link_to role, '#', class: ("is-active" if member.access_level == role_id), - data: { id: role_id, el_id: dom_id(member) } + data: { id: role_id, el_id: dom_id(member), qa_selector: "#{role.downcase}_access_level_link" } = render_if_exists 'shared/members/ee/revert_ldap_group_sync_option', group: @group, member: member, @@ -119,7 +119,7 @@ - else = link_to member, method: :delete, - data: { confirm: remove_member_message(member) }, + data: { confirm: remove_member_message(member), qa_selector: 'delete_member_button' }, class: "btn btn-remove align-self-center m-0 #{'ml-sm-2' unless force_mobile_view}", title: remove_member_title(member) do %span{ class: ('d-block d-sm-none' unless force_mobile_view) } diff --git a/app/workers/build_finished_worker.rb b/app/workers/build_finished_worker.rb index 8e2a18a8fd8..e95b6b38d28 100644 --- a/app/workers/build_finished_worker.rb +++ b/app/workers/build_finished_worker.rb @@ -34,3 +34,5 @@ class BuildFinishedWorker ChatNotificationWorker.perform_async(build.id) if build.pipeline.chat? end end + +BuildFinishedWorker.prepend_if_ee('EE::BuildFinishedWorker') diff --git a/app/workers/new_note_worker.rb b/app/workers/new_note_worker.rb index 1d1ea926c21..7648af3a8b9 100644 --- a/app/workers/new_note_worker.rb +++ b/app/workers/new_note_worker.rb @@ -23,3 +23,5 @@ class NewNoteWorker end # rubocop: enable CodeReuse/ActiveRecord end + +NewNoteWorker.prepend_if_ee('EE::NewNoteWorker') diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index 61d34981458..843ba3e980e 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -117,3 +117,5 @@ class PostReceive Gitlab::GitLogger.error("POST-RECEIVE: #{message}") end end + +PostReceive.prepend_if_ee('EE::PostReceive') diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb index 5ac860c93e0..e3f1f61991c 100644 --- a/app/workers/project_cache_worker.rb +++ b/app/workers/project_cache_worker.rb @@ -3,7 +3,6 @@ # Worker for updating any project specific caches. class ProjectCacheWorker include ApplicationWorker - LEASE_TIMEOUT = 15.minutes.to_i # project_id - The ID of the project for which to flush the cache. @@ -55,3 +54,5 @@ class ProjectCacheWorker ["project_cache_worker", project_id, *statistics.sort].join(":") end end + +ProjectCacheWorker.prepend_if_ee('EE::ProjectCacheWorker') diff --git a/app/workers/repository_check/batch_worker.rb b/app/workers/repository_check/batch_worker.rb index c1bb1adc9cc..4091c30f498 100644 --- a/app/workers/repository_check/batch_worker.rb +++ b/app/workers/repository_check/batch_worker.rb @@ -2,6 +2,8 @@ module RepositoryCheck class BatchWorker + prepend_if_ee('::EE::RepositoryCheck::BatchWorker') # rubocop: disable Cop/InjectEnterpriseEditionModule + include ApplicationWorker include RepositoryCheckQueue include ExclusiveLeaseGuard diff --git a/app/workers/repository_check/single_repository_worker.rb b/app/workers/repository_check/single_repository_worker.rb index a8097af321f..cadb1de356c 100644 --- a/app/workers/repository_check/single_repository_worker.rb +++ b/app/workers/repository_check/single_repository_worker.rb @@ -5,6 +5,8 @@ module RepositoryCheck include ApplicationWorker include RepositoryCheckQueue + prepend_if_ee('::EE::RepositoryCheck::SingleRepositoryWorker') # rubocop: disable Cop/InjectEnterpriseEditionModule + def perform(project_id) project = Project.find(project_id) healthy = project_healthy?(project) diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb index dff9c8f50bf..5be439ecbc5 100644 --- a/app/workers/repository_import_worker.rb +++ b/app/workers/repository_import_worker.rb @@ -48,3 +48,5 @@ class RepositoryImportWorker project.gitlab_project_import? end end + +RepositoryImportWorker.prepend_if_ee('EE::RepositoryImportWorker') |