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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 15:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 15:08:42 +0300
commit0eea37aefa31ed22e32eadbe6164dd92e3c64ec2 (patch)
treee1ec47e8160c6c36a8ae08ba1d39902be068ef05
parent3fbfc0075a306ad85c70c006b978a2e96bd4283a (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--app/assets/javascripts/import_entities/import_groups/components/import_table.vue52
-rw-r--r--app/assets/javascripts/import_entities/import_groups/constants.js3
-rw-r--r--app/assets/javascripts/packages_and_registries/harbor_registry/pages/list.vue3
-rw-r--r--app/policies/project_policy.rb21
-rw-r--r--app/views/admin/application_settings/general.html.haml2
-rw-r--r--app/views/projects/issues/_service_desk_empty_state.html.haml2
-rw-r--r--config/feature_flags/development/faster_owner_access.yml8
-rw-r--r--db/docs/dingtalk_tracker_data.yml8
-rw-r--r--db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb2
-rw-r--r--db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb2
-rw-r--r--db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb2
-rw-r--r--db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb2
-rw-r--r--db/migrate/20220513093614_add_ding_talk_into_application_settings.rb14
-rw-r--r--db/migrate/20220513093615_add_ding_talk_tracker_data.rb15
-rw-r--r--db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb2
-rw-r--r--db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb2
-rw-r--r--db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210727113447_backfill_integrations_type_new.rb2
-rw-r--r--db/post_migrate/20210930211936_backfill_user_namespace.rb2
-rw-r--r--db/post_migrate/20211026070408_backfill_issue_search_data.rb2
-rw-r--r--db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb2
-rw-r--r--db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb2
-rw-r--r--db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb2
-rw-r--r--db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb2
-rw-r--r--db/post_migrate/20220324165436_schedule_backfill_project_settings.rb2
-rw-r--r--db/schema_migrations/202205130936141
-rw-r--r--db/schema_migrations/202205130936151
-rw-r--r--db/structure.sql59
-rw-r--r--doc/administration/instance_limits.md4
-rw-r--r--doc/administration/integration/kroki.md4
-rw-r--r--doc/user/crm/index.md8
-rw-r--r--doc/user/permissions.md1
-rw-r--r--doc/user/project/merge_requests/getting_started.md29
-rw-r--r--doc/user/project/merge_requests/index.md29
-rw-r--r--lib/gitlab/database/gitlab_schemas.yml2
-rw-r--r--lib/gitlab/database/migrations/batched_background_migration_helpers.rb12
-rw-r--r--locale/gitlab.pot22
-rw-r--r--package.json8
-rw-r--r--spec/features/groups/import_export/connect_instance_spec.rb2
-rw-r--r--spec/frontend/import_entities/import_groups/components/import_table_spec.js8
-rw-r--r--spec/lib/gitlab/database/migration_helpers_spec.rb8
-rw-r--r--spec/lib/gitlab/database/migrations/batched_background_migration_helpers_spec.rb26
-rw-r--r--spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb17
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml4
-rw-r--r--spec/models/preloaders/user_max_access_level_in_projects_preloader_spec.rb13
-rw-r--r--spec/policies/project_policy_spec.rb74
-rw-r--r--spec/services/notification_recipients/build_service_spec.rb108
-rw-r--r--yarn.lock36
59 files changed, 517 insertions, 139 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index 301f4080bf2..1a6f562adcc 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-d7eedd059daf9059990a95e53c76e567eac64899
+dc89f1ebfddca732f55d74488f94a6ed25444b07
diff --git a/app/assets/javascripts/import_entities/import_groups/components/import_table.vue b/app/assets/javascripts/import_entities/import_groups/components/import_table.vue
index ce401862cc1..bb8defedb02 100644
--- a/app/assets/javascripts/import_entities/import_groups/components/import_table.vue
+++ b/app/assets/javascripts/import_entities/import_groups/components/import_table.vue
@@ -15,9 +15,11 @@ import { debounce } from 'lodash';
import createFlash from '~/flash';
import { s__, __, n__, sprintf } from '~/locale';
import PaginationBar from '~/vue_shared/components/pagination_bar/pagination_bar.vue';
+import HelpPopover from '~/vue_shared/components/help_popover.vue';
import { getGroupPathAvailability } from '~/rest_api';
import axios from '~/lib/utils/axios_utils';
import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
+import { helpPagePath } from '~/helpers/help_page_helper';
import { STATUSES } from '../../constants';
import ImportStatusCell from '../../components/import_status.vue';
@@ -56,6 +58,7 @@ export default {
ImportStatusCell,
ImportActionsCell,
PaginationBar,
+ HelpPopover,
},
props: {
@@ -190,9 +193,9 @@ export default {
statusMessage() {
return this.filter.length === 0
- ? s__('BulkImport|Showing %{start}-%{end} of %{total} from %{link}')
+ ? s__('BulkImport|Showing %{start}-%{end} of %{total} that you own from %{link}')
: s__(
- 'BulkImport|Showing %{start}-%{end} of %{total} matching filter "%{filter}" from %{link}',
+ 'BulkImport|Showing %{start}-%{end} of %{total} that you own matching filter "%{filter}" from %{link}',
);
},
@@ -484,6 +487,9 @@ export default {
gitlabLogo: window.gon.gitlab_logo,
PAGE_SIZES,
+ permissionsHelpPath: helpPagePath('user/permissions', { anchor: 'group-members-permissions' }),
+ popoverOptions: { title: __('What is listed here?') },
+ i18n,
};
</script>
@@ -533,8 +539,8 @@ export default {
<div
class="gl-py-5 gl-border-solid gl-border-gray-200 gl-border-0 gl-border-b-1 gl-display-flex"
>
- <span>
- <gl-sprintf v-if="!$apollo.loading && hasGroups" :message="statusMessage">
+ <span v-if="!$apollo.loading && hasGroups">
+ <gl-sprintf :message="statusMessage">
<template #start>
<strong>{{ paginationInfo.start }}</strong>
</template>
@@ -548,12 +554,26 @@ export default {
<strong>{{ filter }}</strong>
</template>
<template #link>
- <gl-link :href="sourceUrl" target="_blank">
- {{ sourceUrl }}<gl-icon name="external-link" class="vertical-align-middle" />
- </gl-link>
+ {{ sourceUrl }}
</template>
</gl-sprintf>
+ <help-popover :options="$options.popoverOptions">
+ <gl-sprintf
+ :message="
+ s__(
+ 'BulkImport|Only groups that you have the %{role} role for are listed as groups you can import.',
+ )
+ "
+ >
+ <template #role>
+ <gl-link class="gl-font-sm" :href="$options.permissionsHelpPath" target="_blank">{{
+ $options.i18n.OWNER
+ }}</gl-link>
+ </template>
+ </gl-sprintf>
+ </help-popover>
</span>
+
<gl-search-box-by-click
class="gl-ml-auto"
:placeholder="s__('BulkImport|Filter by source group')"
@@ -568,11 +588,19 @@ export default {
:title="__('Sorry, your filter produced no results')"
:description="__('To widen your search, change or remove filters above.')"
/>
- <gl-empty-state
- v-else-if="!hasGroups"
- :title="s__('BulkImport|You have no groups to import')"
- :description="__('Check your source instance permissions.')"
- />
+ <gl-empty-state v-else-if="!hasGroups" :title="$options.i18n.NO_GROUPS_FOUND">
+ <template #description>
+ <gl-sprintf
+ :message="__('You don\'t have the %{role} role for any groups in this instance.')"
+ >
+ <template #role>
+ <gl-link :href="$options.permissionsHelpPath" target="_blank">{{
+ $options.i18n.OWNER
+ }}</gl-link>
+ </template>
+ </gl-sprintf>
+ </template>
+ </gl-empty-state>
<template v-else>
<div
class="gl-bg-gray-10 gl-border-solid gl-border-gray-200 gl-border-0 gl-border-b-1 gl-px-4 gl-display-flex gl-align-items-center import-table-bar"
diff --git a/app/assets/javascripts/import_entities/import_groups/constants.js b/app/assets/javascripts/import_entities/import_groups/constants.js
index 32137308684..7e532dfec05 100644
--- a/app/assets/javascripts/import_entities/import_groups/constants.js
+++ b/app/assets/javascripts/import_entities/import_groups/constants.js
@@ -12,6 +12,9 @@ export const i18n = {
ERROR_IMPORT: s__('BulkImport|Importing the group failed.'),
ERROR_IMPORT_COMPLETED: s__('BulkImport|Import is finished. Pick another name for re-import'),
+ NO_GROUPS_FOUND: s__('BulkImport|No groups found'),
+ OWNER: __('Owner'),
+
features: {
projectMigration: __('projects'),
},
diff --git a/app/assets/javascripts/packages_and_registries/harbor_registry/pages/list.vue b/app/assets/javascripts/packages_and_registries/harbor_registry/pages/list.vue
index 7aaef2ed57a..9c69059c968 100644
--- a/app/assets/javascripts/packages_and_registries/harbor_registry/pages/list.vue
+++ b/app/assets/javascripts/packages_and_registries/harbor_registry/pages/list.vue
@@ -1,5 +1,6 @@
<script>
import { GlEmptyState, GlSprintf, GlLink, GlSkeletonLoader } from '@gitlab/ui';
+import { escape } from 'lodash';
import HarborListHeader from '~/packages_and_registries/harbor_registry/components/list/harbor_list_header.vue';
import PersistedSearch from '~/packages_and_registries/shared/components/persisted_search.vue';
import HarborList from '~/packages_and_registries/harbor_registry/components/list/harbor_list.vue';
@@ -80,7 +81,7 @@ export default {
this.sorting = sort;
const search = filters.find((i) => i.type === FILTERED_SEARCH_TERM);
- this.name = search?.value?.data;
+ this.name = escape(search?.value?.data);
this.fetchHarborImages();
},
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index 60519dc346b..2700531235a 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -4,12 +4,6 @@ class ProjectPolicy < BasePolicy
include CrudPolicyHelpers
include ReadonlyAbilities
- desc "User is a project owner"
- condition :owner do
- (project.owner.present? && project.owner == @user) ||
- project.group&.has_owner?(@user)
- end
-
desc "Project has public builds enabled"
condition(:public_builds, scope: :subject, score: 0) { project.public_builds? }
@@ -30,6 +24,21 @@ class ProjectPolicy < BasePolicy
desc "User has maintainer access"
condition(:maintainer) { team_access_level >= Gitlab::Access::MAINTAINER }
+ desc "User has owner access"
+ condition :owner do
+ owner_of_personal_namespace = project.owner.present? && project.owner == @user
+
+ unless owner_of_personal_namespace
+ group_or_project_owner = if Feature.enabled?(:faster_owner_access)
+ team_access_level >= Gitlab::Access::OWNER
+ else
+ project.group&.has_owner?(@user)
+ end
+ end
+
+ owner_of_personal_namespace || group_or_project_owner
+ end
+
desc "User is a project bot"
condition(:project_bot) { user.project_bot? && team_member? }
diff --git a/app/views/admin/application_settings/general.html.haml b/app/views/admin/application_settings/general.html.haml
index 7643f8fa7a7..63b92f529c5 100644
--- a/app/views/admin/application_settings/general.html.haml
+++ b/app/views/admin/application_settings/general.html.haml
@@ -111,6 +111,8 @@
= render 'admin/application_settings/plantuml'
= render 'admin/application_settings/sourcegraph'
= render_if_exists 'admin/application_settings/slack'
+-# this partial is from JiHu, see details in https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/417
+= render_if_exists 'admin/application_settings/dingtalk_integration'
= render 'admin/application_settings/third_party_offers'
= render 'admin/application_settings/snowplow'
= render 'admin/application_settings/eks'
diff --git a/app/views/projects/issues/_service_desk_empty_state.html.haml b/app/views/projects/issues/_service_desk_empty_state.html.haml
index efc319ed8df..1c9143c633d 100644
--- a/app/views/projects/issues/_service_desk_empty_state.html.haml
+++ b/app/views/projects/issues/_service_desk_empty_state.html.haml
@@ -21,7 +21,7 @@
- if can_edit_project_settings && !service_desk_enabled
.text-center
- = link_to s_("ServiceDesk|Enable Service Desk"), edit_project_path(@project), class: 'gl-button btn btn-success'
+ = link_to s_("ServiceDesk|Enable Service Desk"), edit_project_path(@project), class: 'gl-button btn btn-confirm'
- else
.empty-state
.svg-content
diff --git a/config/feature_flags/development/faster_owner_access.yml b/config/feature_flags/development/faster_owner_access.yml
new file mode 100644
index 00000000000..29c15a7b68c
--- /dev/null
+++ b/config/feature_flags/development/faster_owner_access.yml
@@ -0,0 +1,8 @@
+---
+name: faster_owner_access
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82177
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/362328
+milestone: '15.0'
+type: development
+group: group::workspace
+default_enabled: true
diff --git a/db/docs/dingtalk_tracker_data.yml b/db/docs/dingtalk_tracker_data.yml
new file mode 100644
index 00000000000..b7335584271
--- /dev/null
+++ b/db/docs/dingtalk_tracker_data.yml
@@ -0,0 +1,8 @@
+---
+table_name: dingtalk_tracker_data
+classes:
+- Integrations::DingtalkTrackerData
+feature_categories:
+- integrations
+description: Data related to the Dingtalk integration (JiHu-specific, see https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/417).
+milestone: '15.0'
diff --git a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
index 63ac308e4be..778e186eb9c 100644
--- a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
+++ b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillTaggingsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :taggings
COLUMNS = %i(id taggable_id)
diff --git a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
index 6de89cadef8..0795abf19d4 100644
--- a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
+++ b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillDeploymentsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :deployments
COLUMNS = %i(deployable_id)
diff --git a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
index eab79a33006..c2845760b5c 100644
--- a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
+++ b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillGeoJobArtifactDeletedEventsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :geo_job_artifact_deleted_events
COLUMNS = %i(job_artifact_id)
diff --git a/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb b/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb
index 6376305c784..4a52600d4c7 100644
--- a/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb
+++ b/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiStagesForBigintConversion < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :ci_stages
COLUMNS = %i(id)
diff --git a/db/migrate/20220513093614_add_ding_talk_into_application_settings.rb b/db/migrate/20220513093614_add_ding_talk_into_application_settings.rb
new file mode 100644
index 00000000000..5a34200a3c8
--- /dev/null
+++ b/db/migrate/20220513093614_add_ding_talk_into_application_settings.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class AddDingTalkIntoApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :application_settings, :dingtalk_integration_enabled, :boolean, null: false,
+ default: false, comment: 'JiHu-specific column'
+ add_column :application_settings, :encrypted_dingtalk_corpid, :binary, comment: 'JiHu-specific column'
+ add_column :application_settings, :encrypted_dingtalk_corpid_iv, :binary, comment: 'JiHu-specific column'
+ add_column :application_settings, :encrypted_dingtalk_app_key, :binary, comment: 'JiHu-specific column'
+ add_column :application_settings, :encrypted_dingtalk_app_key_iv, :binary, comment: 'JiHu-specific column'
+ add_column :application_settings, :encrypted_dingtalk_app_secret, :binary, comment: 'JiHu-specific column'
+ add_column :application_settings, :encrypted_dingtalk_app_secret_iv, :binary, comment: 'JiHu-specific column'
+ end
+end
diff --git a/db/migrate/20220513093615_add_ding_talk_tracker_data.rb b/db/migrate/20220513093615_add_ding_talk_tracker_data.rb
new file mode 100644
index 00000000000..0a9c340fbf0
--- /dev/null
+++ b/db/migrate/20220513093615_add_ding_talk_tracker_data.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddDingTalkTrackerData < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_on_dingtalk_tracker_data_corpid'
+
+ def change
+ create_table :dingtalk_tracker_data, comment: 'JiHu-specific table' do |t|
+ t.references :integration, foreign_key: { on_delete: :cascade },
+ type: :bigint, index: true, null: false, comment: 'JiHu-specific column'
+ t.timestamps_with_timezone
+ t.text :corpid, comment: 'JiHu-specific column', limit: 255
+ t.index :corpid, where: "(corpid IS NOT NULL)", name: INDEX_NAME, comment: 'JiHu-specific index'
+ end
+ end
+end
diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
index 37546a793f7..b9427f7cc93 100644
--- a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
DOWNTIME = false
def up
diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
index 87250c82244..bb444f5b407 100644
--- a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migration[6.0]
+ disable_ddl_transaction!
+
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
index 3e4f1450632..1ee67cd9dda 100644
--- a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
+++ b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiBuildNeedsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
DOWNTIME = false
def up
diff --git a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
index b6b37acab3b..67076cc647a 100644
--- a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
+++ b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
@@ -5,6 +5,8 @@ class BackfillConversionOfCiJobArtifacts < ActiveRecord::Migration[6.0]
DOWNTIME = false
+ disable_ddl_transaction!
+
def up
return unless should_run?
diff --git a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
index 0aea924c982..bde91473ee3 100644
--- a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiSourcesPipelinesSourceJobIdForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
def up
return unless should_run?
diff --git a/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb
index 972df41f678..fd071ec9a1a 100644
--- a/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb
+++ b/db/post_migrate/20210426094549_backfill_ci_builds_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiBuildsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
DOWNTIME = false
TABLE = :ci_builds
diff --git a/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb b/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb
index 4c656f56a32..7e11d38868b 100644
--- a/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb
+++ b/db/post_migrate/20210427045711_backfill_ci_build_trace_chunks_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiBuildTraceChunksForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :ci_build_trace_chunks
COLUMNS = %i(build_id)
diff --git a/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb b/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb
index b548309cdb7..fa0420fe426 100644
--- a/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb
+++ b/db/post_migrate/20210427085020_backfill_ci_builds_runner_session_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiBuildsRunnerSessionForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :ci_builds_runner_session
COLUMNS = %i(build_id)
diff --git a/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb b/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb
index 979ce5edfeb..340dceda254 100644
--- a/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb
+++ b/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiBuildTraceSectionsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :ci_build_trace_sections
COLUMN = :build_id
diff --git a/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb b/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb
index 3aeabbcc0ad..39dd78975da 100644
--- a/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb
+++ b/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class BackfillCiBuildsMetadataForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :ci_builds_metadata
COLUMN = :build_id
diff --git a/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb b/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb
index d554b412420..68bc82059bc 100644
--- a/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb
+++ b/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb
@@ -3,6 +3,8 @@
class BackfillPkConversionForSelfManaged < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
CONVERSIONS = [
{ table: :events, columns: %i(id), sub_batch_size: 500 },
{ table: :push_event_payloads, columns: %i(event_id), sub_batch_size: 2500, primary_key: :event_id },
diff --git a/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb b/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb
index ecf9040eb46..a9f6d4ea2d9 100644
--- a/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210705143150_backfill_ci_builds_metadata_id_for_bigint_conversion.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class BackfillCiBuildsMetadataIdForBigintConversion < ActiveRecord::Migration[6.1]
+ disable_ddl_transaction!
+
include Gitlab::Database::MigrationHelpers
TABLE = :ci_builds_metadata
diff --git a/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb b/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb
index 840540bb0d4..78ae4f23286 100644
--- a/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb
+++ b/db/post_migrate/20210722110515_revert_backfill_ci_build_trace_sections_for_bigint_conversion.rb
@@ -3,6 +3,8 @@
class RevertBackfillCiBuildTraceSectionsForBigintConversion < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
TABLE = :ci_build_trace_sections
COLUMN = :build_id
diff --git a/db/post_migrate/20210727113447_backfill_integrations_type_new.rb b/db/post_migrate/20210727113447_backfill_integrations_type_new.rb
index eb6095abdb5..47238bae4d5 100644
--- a/db/post_migrate/20210727113447_backfill_integrations_type_new.rb
+++ b/db/post_migrate/20210727113447_backfill_integrations_type_new.rb
@@ -3,6 +3,8 @@
class BackfillIntegrationsTypeNew < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
MIGRATION = 'BackfillIntegrationsTypeNew'
INTERVAL = 2.minutes
diff --git a/db/post_migrate/20210930211936_backfill_user_namespace.rb b/db/post_migrate/20210930211936_backfill_user_namespace.rb
index 3d9228f21f1..6d71b09ad63 100644
--- a/db/post_migrate/20210930211936_backfill_user_namespace.rb
+++ b/db/post_migrate/20210930211936_backfill_user_namespace.rb
@@ -7,6 +7,8 @@ class BackfillUserNamespace < Gitlab::Database::Migration[1.0]
SUB_BATCH_SIZE = 200
DOWNTIME = false
+ disable_ddl_transaction!
+
def up
queue_batched_background_migration(
MIGRATION,
diff --git a/db/post_migrate/20211026070408_backfill_issue_search_data.rb b/db/post_migrate/20211026070408_backfill_issue_search_data.rb
index c0073036944..a2cf7b36a59 100644
--- a/db/post_migrate/20211026070408_backfill_issue_search_data.rb
+++ b/db/post_migrate/20211026070408_backfill_issue_search_data.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class BackfillIssueSearchData < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
MIGRATION = 'BackfillIssueSearchData'
def up
diff --git a/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb b/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb
index 57ac4fe825e..68279456ddd 100644
--- a/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb
+++ b/db/post_migrate/20220120123800_backfill_namespace_id_for_namespace_routes.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class BackfillNamespaceIdForNamespaceRoutes < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
MIGRATION = 'BackfillNamespaceIdForNamespaceRoute'
INTERVAL = 2.minutes
BATCH_SIZE = 1_000
diff --git a/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb b/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb
index f77c40a0b4e..279084e0fc5 100644
--- a/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb
+++ b/db/post_migrate/20220120211832_backfill_member_namespace_id_for_group_members.rb
@@ -7,6 +7,8 @@ class BackfillMemberNamespaceIdForGroupMembers < Gitlab::Database::Migration[1.0
MAX_BATCH_SIZE = 2_000
SUB_BATCH_SIZE = 100
+ disable_ddl_transaction!
+
def up
queue_batched_background_migration(
MIGRATION,
diff --git a/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
index d361aff5738..10b6ab8204d 100644
--- a/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
+++ b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class ScheduleNullifyOrphanRunnerIdOnCiBuilds < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
MIGRATION = 'NullifyOrphanRunnerIdOnCiBuilds'
INTERVAL = 2.minutes
BATCH_SIZE = 50_000
diff --git a/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb b/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb
index 5a4d14dcfb7..21b8dc78f7d 100644
--- a/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb
+++ b/db/post_migrate/20220322071127_finalize_project_namespaces_backfill.rb
@@ -4,6 +4,8 @@
# so that other migrations that depend on project namespace back-filling cannot be run unless project namespace
# back-filling has finalized successfully.
class FinalizeProjectNamespacesBackfill < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
MIGRATION = 'ProjectNamespaces::BackfillProjectNamespaces'
def up
diff --git a/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb b/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb
index 1ca1f29a2da..07a7b8b8989 100644
--- a/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb
+++ b/db/post_migrate/20220324165436_schedule_backfill_project_settings.rb
@@ -6,6 +6,8 @@ class ScheduleBackfillProjectSettings < Gitlab::Database::Migration[1.0]
BATCH_SIZE = 5_000
SUB_BATCH_SIZE = 200
+ disable_ddl_transaction!
+
def up
queue_batched_background_migration(
MIGRATION,
diff --git a/db/schema_migrations/20220513093614 b/db/schema_migrations/20220513093614
new file mode 100644
index 00000000000..2fd5b217597
--- /dev/null
+++ b/db/schema_migrations/20220513093614
@@ -0,0 +1 @@
+a10b3c81942eacdd4d378e8f1d1e28b974e973ef163ddfbe0cdea1f63b275dd1 \ No newline at end of file
diff --git a/db/schema_migrations/20220513093615 b/db/schema_migrations/20220513093615
new file mode 100644
index 00000000000..3b306069feb
--- /dev/null
+++ b/db/schema_migrations/20220513093615
@@ -0,0 +1 @@
+a070aa428ef721bccfc1499dae04d0796877796339380370c3f32f7e12c029df \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index fa0f6a40688..db235d6d2d6 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11305,6 +11305,13 @@ CREATE TABLE application_settings (
container_registry_pre_import_timeout integer DEFAULT 1800 NOT NULL,
container_registry_import_timeout integer DEFAULT 600 NOT NULL,
pipeline_limit_per_project_user_sha integer DEFAULT 0 NOT NULL,
+ dingtalk_integration_enabled boolean DEFAULT false NOT NULL,
+ encrypted_dingtalk_corpid bytea,
+ encrypted_dingtalk_corpid_iv bytea,
+ encrypted_dingtalk_app_key bytea,
+ encrypted_dingtalk_app_key_iv bytea,
+ encrypted_dingtalk_app_secret bytea,
+ encrypted_dingtalk_app_secret_iv bytea,
globally_allowed_ips text DEFAULT ''::text NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
@@ -11350,6 +11357,20 @@ COMMENT ON COLUMN application_settings.encrypted_content_validation_api_key_iv I
COMMENT ON COLUMN application_settings.content_validation_endpoint_enabled IS 'JiHu-specific column';
+COMMENT ON COLUMN application_settings.dingtalk_integration_enabled IS 'JiHu-specific column';
+
+COMMENT ON COLUMN application_settings.encrypted_dingtalk_corpid IS 'JiHu-specific column';
+
+COMMENT ON COLUMN application_settings.encrypted_dingtalk_corpid_iv IS 'JiHu-specific column';
+
+COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_key IS 'JiHu-specific column';
+
+COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_key_iv IS 'JiHu-specific column';
+
+COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_secret IS 'JiHu-specific column';
+
+COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_secret_iv IS 'JiHu-specific column';
+
CREATE SEQUENCE application_settings_id_seq
START WITH 1
INCREMENT BY 1
@@ -14530,6 +14551,30 @@ CREATE SEQUENCE diff_note_positions_id_seq
ALTER SEQUENCE diff_note_positions_id_seq OWNED BY diff_note_positions.id;
+CREATE TABLE dingtalk_tracker_data (
+ id bigint NOT NULL,
+ integration_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ corpid text,
+ CONSTRAINT check_d3fe332e6a CHECK ((char_length(corpid) <= 255))
+);
+
+COMMENT ON TABLE dingtalk_tracker_data IS 'JiHu-specific table';
+
+COMMENT ON COLUMN dingtalk_tracker_data.integration_id IS 'JiHu-specific column';
+
+COMMENT ON COLUMN dingtalk_tracker_data.corpid IS 'JiHu-specific column';
+
+CREATE SEQUENCE dingtalk_tracker_data_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE dingtalk_tracker_data_id_seq OWNED BY dingtalk_tracker_data.id;
+
CREATE TABLE dora_daily_metrics (
id bigint NOT NULL,
environment_id bigint NOT NULL,
@@ -22660,6 +22705,8 @@ ALTER TABLE ONLY detached_partitions ALTER COLUMN id SET DEFAULT nextval('detach
ALTER TABLE ONLY diff_note_positions ALTER COLUMN id SET DEFAULT nextval('diff_note_positions_id_seq'::regclass);
+ALTER TABLE ONLY dingtalk_tracker_data ALTER COLUMN id SET DEFAULT nextval('dingtalk_tracker_data_id_seq'::regclass);
+
ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_daily_metrics_id_seq'::regclass);
ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass);
@@ -24461,6 +24508,9 @@ ALTER TABLE ONLY detached_partitions
ALTER TABLE ONLY diff_note_positions
ADD CONSTRAINT diff_note_positions_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dingtalk_tracker_data
+ ADD CONSTRAINT dingtalk_tracker_data_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY dora_daily_metrics
ADD CONSTRAINT dora_daily_metrics_pkey PRIMARY KEY (id);
@@ -27602,6 +27652,8 @@ CREATE UNIQUE INDEX index_design_user_mentions_on_note_id ON design_user_mention
CREATE UNIQUE INDEX index_diff_note_positions_on_note_id_and_diff_type ON diff_note_positions USING btree (note_id, diff_type);
+CREATE INDEX index_dingtalk_tracker_data_on_integration_id ON dingtalk_tracker_data USING btree (integration_id);
+
CREATE UNIQUE INDEX index_dora_daily_metrics_on_environment_id_and_date ON dora_daily_metrics USING btree (environment_id, date);
CREATE INDEX index_draft_notes_on_author_id ON draft_notes USING btree (author_id);
@@ -28474,6 +28526,10 @@ CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON oauth_openid_requ
CREATE UNIQUE INDEX index_on_deploy_keys_id_and_type_and_public ON keys USING btree (id, type) WHERE (public = true);
+CREATE INDEX index_on_dingtalk_tracker_data_corpid ON dingtalk_tracker_data USING btree (corpid) WHERE (corpid IS NOT NULL);
+
+COMMENT ON INDEX index_on_dingtalk_tracker_data_corpid IS 'JiHu-specific index';
+
CREATE INDEX index_on_group_id_on_webhooks ON web_hooks USING btree (group_id);
CREATE INDEX index_on_identities_lower_extern_uid_and_provider ON identities USING btree (lower((extern_uid)::text), provider);
@@ -32973,6 +33029,9 @@ ALTER TABLE ONLY resource_milestone_events
ALTER TABLE ONLY namespace_root_storage_statistics
ADD CONSTRAINT fk_rails_a0702c430b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dingtalk_tracker_data
+ ADD CONSTRAINT fk_rails_a138e0d542 FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY elastic_reindexing_slices
ADD CONSTRAINT fk_rails_a17d86aeb9 FOREIGN KEY (elastic_reindexing_subtask_id) REFERENCES elastic_reindexing_subtasks(id) ON DELETE CASCADE;
diff --git a/doc/administration/instance_limits.md b/doc/administration/instance_limits.md
index 8d3fec3b19e..14b251bed01 100644
--- a/doc/administration/instance_limits.md
+++ b/doc/administration/instance_limits.md
@@ -646,7 +646,7 @@ Update `ci_jobs_trace_size_limit` with the new value in megabytes:
Plan.default.actual_limits.update!(ci_jobs_trace_size_limit: 125)
```
-GitLab Runner also has an
+GitLab Runner also has an
[`output_limit` setting](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section)
that configures the maximum log size in a runner. Jobs that exceed the runner limit
continue to run, but the log is truncated when it hits the limit.
@@ -981,7 +981,7 @@ varies by file type:
If a branch is merged while open merge requests still point to it, GitLab can
retarget merge requests pointing to the now-merged branch. To learn more, read
-[Branch retargeting on merge](../user/project/merge_requests/getting_started.md#branch-retargeting-on-merge).
+[Update merge requests when target branch merges](../user/project/merge_requests/index.md#update-merge-requests-when-target-branch-merges).
## CDN-based limits on GitLab.com
diff --git a/doc/administration/integration/kroki.md b/doc/administration/integration/kroki.md
index 0f02e3783a5..a6fcfe6c80f 100644
--- a/doc/administration/integration/kroki.md
+++ b/doc/administration/integration/kroki.md
@@ -1,6 +1,6 @@
---
-stage: Ecosystem
-group: Integrations
+stage: Plan
+group: Project Management
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
diff --git a/doc/user/crm/index.md b/doc/user/crm/index.md
index 7a400205e30..bec67acae3e 100644
--- a/doc/user/crm/index.md
+++ b/doc/user/crm/index.md
@@ -33,9 +33,13 @@ To read more about what is planned for the future, see [issue 2256](https://gitl
## Enable customer relations management (CRM)
-To enable customer relations management in a group:
+Customer relations management features must be enabled at the group level. If your
+group also contains subgroups, and you want to use CRM features in the subgroup,
+you must enable CRM features for the subgroup.
-1. On the top bar, select **Menu > Groups** and find your group.
+To enable customer relations management in a group or subgroup:
+
+1. On the top bar, select **Menu > Groups** and find your group or subgroup.
1. On the left sidebar, select **Settings > General**.
1. Expand the **Permissions and group features** section.
1. Select **Enable customer relations**.
diff --git a/doc/user/permissions.md b/doc/user/permissions.md
index d28cf75d11f..433274c63b9 100644
--- a/doc/user/permissions.md
+++ b/doc/user/permissions.md
@@ -428,6 +428,7 @@ The following table lists group permissions available for each role:
| View [Billing](../subscriptions/gitlab_com/index.md#view-your-gitlab-saas-subscription) | | | | | ✓ (4) |
| View group [Usage Quotas](usage_quotas.md) page | | | | | ✓ (4) |
| Manage group runners | | | | | ✓ |
+| GitLab migration | | | | | ✓ |
<!-- markdownlint-disable MD029 -->
diff --git a/doc/user/project/merge_requests/getting_started.md b/doc/user/project/merge_requests/getting_started.md
index c1986a80ca0..1bfaef9d82b 100644
--- a/doc/user/project/merge_requests/getting_started.md
+++ b/doc/user/project/merge_requests/getting_started.md
@@ -140,35 +140,6 @@ is set for deletion, the merge request widget displays the
![Delete source branch status](img/remove_source_branch_status.png)
-### Branch retargeting on merge **(FREE SELF)**
-
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/320902) in GitLab 13.9.
-> - [Disabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/320902) in GitLab 13.9.
-> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/320895) GitLab 13.10.
-
-In specific circumstances, GitLab can retarget the destination branch of
-open merge request, if the destination branch merges while the merge request is
-open. Merge requests are often chained in this manner, with one merge request
-depending on another:
-
-- **Merge request 1**: merge `feature-alpha` into `main`.
-- **Merge request 2**: merge `feature-beta` into `feature-alpha`.
-
-These merge requests are usually handled in one of these ways:
-
-- Merge request 1 is merged into `main` first. Merge request 2 is then
- retargeted to `main`.
-- Merge request 2 is merged into `feature-alpha`. The updated merge request 1, which
- now contains the contents of `feature-alpha` and `feature-beta`, is merged into `main`.
-
-GitLab retargets up to four merge requests when their target branch is merged into
-`main`, so you don't need to perform this operation manually. Merge requests from
-forks are not retargeted.
-
-The feature today works only on merge. Clicking the **Remove source branch** button
-after the merge request was merged will not automatically retarget a merge request.
-This improvement is [tracked as a follow-up](https://gitlab.com/gitlab-org/gitlab/-/issues/321559).
-
## Recommendations and best practices for merge requests
- When working locally in your branch, add multiple commits and only push when
diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md
index 510dcd82907..cac7aca7639 100644
--- a/doc/user/project/merge_requests/index.md
+++ b/doc/user/project/merge_requests/index.md
@@ -136,6 +136,35 @@ To delete a merge request:
1. Go to the merge request you want to delete, and select **Edit**.
1. Scroll to the bottom of the page, and select **Delete merge request**.
+### Update merge requests when target branch merges **(FREE SELF)**
+
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/320902) in GitLab 13.9.
+> - [Disabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/320902) in GitLab 13.9.
+> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/320895) GitLab 13.10.
+
+Merge requests are often chained together, with one merge request depending on
+the code added or changed in another merge request. To support keeping individual
+merge requests small, GitLab can update up to four open merge requests when their
+target branch merges into `main`. For example:
+
+- **Merge request 1**: merge `feature-alpha` into `main`.
+- **Merge request 2**: merge `feature-beta` into `feature-alpha`.
+
+If these merge requests are open at the same time, and merge request 1 (`feature-alpha`)
+merges into `main`, GitLab updates the destination of merge request 2 from `feature-alpha`
+to `main`.
+
+Merge requests with interconnected content updates are usually handled in one of these ways:
+
+- Merge request 1 is merged into `main` first. Merge request 2 is then
+ retargeted to `main`.
+- Merge request 2 is merged into `feature-alpha`. The updated merge request 1, which
+ now contains the contents of `feature-alpha` and `feature-beta`, is merged into `main`.
+
+This feature works only when a merge request is merged. Selecting **Remove source branch**
+after merging does not retarget open merge requests. This improvement is
+[proposed as a follow-up](https://gitlab.com/gitlab-org/gitlab/-/issues/321559).
+
## Request attention to a merge request
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/343528) in GitLab 14.10 [with a flag](../../../administration/feature_flags.md) named `mr_attention_requests`. Disabled by default.
diff --git a/lib/gitlab/database/gitlab_schemas.yml b/lib/gitlab/database/gitlab_schemas.yml
index 036ce7d7631..d779da6e597 100644
--- a/lib/gitlab/database/gitlab_schemas.yml
+++ b/lib/gitlab/database/gitlab_schemas.yml
@@ -561,5 +561,7 @@ x509_certificates: :gitlab_main
x509_commit_signatures: :gitlab_main
x509_issuers: :gitlab_main
zentao_tracker_data: :gitlab_main
+# dingtalk_tracker_data JiHu-specific, see https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/417
+dingtalk_tracker_data: :gitlab_main
zoom_meetings: :gitlab_main
batched_background_migration_job_transition_logs: :gitlab_shared
diff --git a/lib/gitlab/database/migrations/batched_background_migration_helpers.rb b/lib/gitlab/database/migrations/batched_background_migration_helpers.rb
index 72b94964c5b..079a14824c0 100644
--- a/lib/gitlab/database/migrations/batched_background_migration_helpers.rb
+++ b/lib/gitlab/database/migrations/batched_background_migration_helpers.rb
@@ -72,6 +72,12 @@ module Gitlab
)
Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_dml_mode!
+ if transaction_open?
+ raise 'The `queue_batched_background_migration` cannot be run inside a transaction. ' \
+ 'You can disable transactions by calling `disable_ddl_transaction!` in the body of ' \
+ 'your migration class.'
+ end
+
gitlab_schema ||= gitlab_schema_from_context
Gitlab::Database::BackgroundMigration::BatchedMigration.reset_column_information
@@ -136,6 +142,12 @@ module Gitlab
def finalize_batched_background_migration(job_class_name:, table_name:, column_name:, job_arguments:)
Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_dml_mode!
+ if transaction_open?
+ raise 'The `finalize_batched_background_migration` cannot be run inside a transaction. ' \
+ 'You can disable transactions by calling `disable_ddl_transaction!` in the body of ' \
+ 'your migration class.'
+ end
+
database_name = Gitlab::Database.db_config_name(connection)
unless ActiveRecord::Base.configurations.primary?(database_name)
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index a4d299b455b..733f7f7fa0a 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -6694,12 +6694,18 @@ msgstr ""
msgid "BulkImport|No additional information provided."
msgstr ""
+msgid "BulkImport|No groups found"
+msgstr ""
+
msgid "BulkImport|No history is available"
msgstr ""
msgid "BulkImport|No parent"
msgstr ""
+msgid "BulkImport|Only groups that you have the %{role} role for are listed as groups you can import."
+msgstr ""
+
msgid "BulkImport|Project import history"
msgstr ""
@@ -6709,10 +6715,10 @@ msgstr ""
msgid "BulkImport|Showing %{start}-%{end} of %{total}"
msgstr ""
-msgid "BulkImport|Showing %{start}-%{end} of %{total} from %{link}"
+msgid "BulkImport|Showing %{start}-%{end} of %{total} that you own from %{link}"
msgstr ""
-msgid "BulkImport|Showing %{start}-%{end} of %{total} matching filter \"%{filter}\" from %{link}"
+msgid "BulkImport|Showing %{start}-%{end} of %{total} that you own matching filter \"%{filter}\" from %{link}"
msgstr ""
msgid "BulkImport|Source"
@@ -6730,9 +6736,6 @@ msgstr ""
msgid "BulkImport|Update of import statuses with realtime changes failed"
msgstr ""
-msgid "BulkImport|You have no groups to import"
-msgstr ""
-
msgid "BulkImport|Your imported groups will appear here."
msgstr ""
@@ -7470,9 +7473,6 @@ msgstr ""
msgid "Check your Kubernetes cluster images for known vulnerabilities."
msgstr ""
-msgid "Check your source instance permissions."
-msgstr ""
-
msgid "Checking %{text} availability…"
msgstr ""
@@ -42613,6 +42613,9 @@ msgstr ""
msgid "What is Markdown?"
msgstr ""
+msgid "What is listed here?"
+msgstr ""
+
msgid "What is repository mirroring?"
msgstr ""
@@ -43433,6 +43436,9 @@ msgstr ""
msgid "You don't have sufficient permission to perform this action."
msgstr ""
+msgid "You don't have the %{role} role for any groups in this instance."
+msgstr ""
+
msgid "You don't have write access to the source branch."
msgstr ""
diff --git a/package.json b/package.json
index 73778428426..db1ea077889 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
"@rails/ujs": "6.1.4-7",
"@sentry/browser": "5.30.0",
"@sourcegraph/code-host-integration": "0.0.60",
- "@tiptap/core": "^2.0.0-beta.175",
+ "@tiptap/core": "^2.0.0-beta.176",
"@tiptap/extension-blockquote": "^2.0.0-beta.26",
"@tiptap/extension-bold": "^2.0.0-beta.26",
"@tiptap/extension-bullet-list": "^2.0.0-beta.26",
@@ -78,21 +78,21 @@
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.31",
"@tiptap/extension-image": "^2.0.0-beta.27",
"@tiptap/extension-italic": "^2.0.0-beta.26",
- "@tiptap/extension-link": "^2.0.0-beta.37",
+ "@tiptap/extension-link": "^2.0.0-beta.38",
"@tiptap/extension-list-item": "^2.0.0-beta.20",
"@tiptap/extension-ordered-list": "^2.0.0-beta.27",
"@tiptap/extension-paragraph": "^2.0.0-beta.23",
"@tiptap/extension-strike": "^2.0.0-beta.27",
"@tiptap/extension-subscript": "^2.0.0-beta.10",
"@tiptap/extension-superscript": "^2.0.0-beta.10",
- "@tiptap/extension-table": "^2.0.0-beta.48",
+ "@tiptap/extension-table": "^2.0.0-beta.49",
"@tiptap/extension-table-cell": "^2.0.0-beta.20",
"@tiptap/extension-table-header": "^2.0.0-beta.22",
"@tiptap/extension-table-row": "^2.0.0-beta.19",
"@tiptap/extension-task-item": "^2.0.0-beta.32",
"@tiptap/extension-task-list": "^2.0.0-beta.26",
"@tiptap/extension-text": "^2.0.0-beta.15",
- "@tiptap/vue-2": "^2.0.0-beta.78",
+ "@tiptap/vue-2": "^2.0.0-beta.79",
"@toast-ui/editor": "^2.5.2",
"@toast-ui/vue-editor": "^2.5.2",
"apollo-upload-client": "15.0.0",
diff --git a/spec/features/groups/import_export/connect_instance_spec.rb b/spec/features/groups/import_export/connect_instance_spec.rb
index 552b599a3f3..ae03e64cf59 100644
--- a/spec/features/groups/import_export/connect_instance_spec.rb
+++ b/spec/features/groups/import_export/connect_instance_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do
click_on 'Connect instance'
- expect(page).to have_content 'Showing 1-1 of 42 groups from %{url}' % { url: source_url }
+ expect(page).to have_content 'Showing 1-1 of 42 groups that you own from %{url}' % { url: source_url }
expect(page).to have_content 'stub-group'
visit '/'
diff --git a/spec/frontend/import_entities/import_groups/components/import_table_spec.js b/spec/frontend/import_entities/import_groups/components/import_table_spec.js
index 1939e43e5dc..0279ad454d2 100644
--- a/spec/frontend/import_entities/import_groups/components/import_table_spec.js
+++ b/spec/frontend/import_entities/import_groups/components/import_table_spec.js
@@ -122,7 +122,7 @@ describe('import table', () => {
});
await waitForPromises();
- expect(wrapper.find(GlEmptyState).props().title).toBe('You have no groups to import');
+ expect(wrapper.find(GlEmptyState).props().title).toBe(i18n.NO_GROUPS_FOUND);
});
});
@@ -297,7 +297,7 @@ describe('import table', () => {
wrapper.find(PaginationLinks).props().change(REQUESTED_PAGE);
await waitForPromises();
- expect(wrapper.text()).toContain('Showing 21-21 of 38 groups from');
+ expect(wrapper.text()).toContain('Showing 21-21 of 38 groups that you own from');
});
});
@@ -349,7 +349,9 @@ describe('import table', () => {
await setFilter(FILTER_VALUE);
await waitForPromises();
- expect(wrapper.text()).toContain('Showing 1-1 of 40 groups matching filter "foo" from');
+ expect(wrapper.text()).toContain(
+ 'Showing 1-1 of 40 groups that you own matching filter "foo" from',
+ );
});
it('properly resets filter in graphql query when search box is cleared', async () => {
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb
index 5d9963bf3ea..3fe3e37b57f 100644
--- a/spec/lib/gitlab/database/migration_helpers_spec.rb
+++ b/spec/lib/gitlab/database/migration_helpers_spec.rb
@@ -2079,6 +2079,8 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
t.integer :other_id
t.timestamps
end
+
+ allow(model).to receive(:transaction_open?).and_return(false)
end
context 'when the target table does not exist' do
@@ -2191,6 +2193,8 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
t.timestamps
end
+ allow(model).to receive(:transaction_open?).and_return(false)
+
model.initialize_conversion_of_integer_to_bigint(table, columns, primary_key: primary_key)
model.backfill_conversion_of_integer_to_bigint(table, columns, primary_key: primary_key)
end
@@ -2246,6 +2250,10 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
configuration.merge(gitlab_schema: Gitlab::Database.gitlab_schemas_for_connection(model.connection).first)
end
+ before do
+ allow(model).to receive(:transaction_open?).and_return(false)
+ end
+
subject(:ensure_batched_background_migration_is_finished) { model.ensure_batched_background_migration_is_finished(**configuration) }
it 'raises an error when migration exists and is not marked as finished' do
diff --git a/spec/lib/gitlab/database/migrations/batched_background_migration_helpers_spec.rb b/spec/lib/gitlab/database/migrations/batched_background_migration_helpers_spec.rb
index 87b6c65bf7e..daddc510963 100644
--- a/spec/lib/gitlab/database/migrations/batched_background_migration_helpers_spec.rb
+++ b/spec/lib/gitlab/database/migrations/batched_background_migration_helpers_spec.rb
@@ -13,6 +13,8 @@ RSpec.describe Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers d
before do
allow(Gitlab::Database::PgClass).to receive(:for_table).and_call_original
expect(Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas).to receive(:require_dml_mode!)
+
+ allow(migration).to receive(:transaction_open?).and_return(false)
end
context 'when such migration already exists' do
@@ -165,6 +167,17 @@ RSpec.describe Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers d
expect(Gitlab::Database::BackgroundMigration::BatchedMigration.last).to be_finished
end
+
+ context 'when within transaction' do
+ before do
+ allow(migration).to receive(:transaction_open?).and_return(true)
+ end
+
+ it 'does raise an exception' do
+ expect { migration.queue_batched_background_migration('MyJobClass', :events, :id, job_interval: 5.minutes)}
+ .to raise_error /`queue_batched_background_migration` cannot be run inside a transaction./
+ end
+ end
end
end
@@ -188,6 +201,8 @@ RSpec.describe Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers d
before do
expect(Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas).to receive(:require_dml_mode!)
+
+ allow(migration).to receive(:transaction_open?).and_return(false)
end
it 'finalizes the migration' do
@@ -226,6 +241,17 @@ RSpec.describe Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers d
end.to raise_error /is currently not supported when running in decomposed/
end
end
+
+ context 'when within transaction' do
+ before do
+ allow(migration).to receive(:transaction_open?).and_return(true)
+ end
+
+ it 'does raise an exception' do
+ expect { migration.finalize_batched_background_migration(job_class_name: 'MyJobClass', table_name: :projects, column_name: :id, job_arguments: []) }
+ .to raise_error /`finalize_batched_background_migration` cannot be run inside a transaction./
+ end
+ end
end
describe '#delete_batched_background_migration' do
diff --git a/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb b/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb
index fbfff1268cc..2f3d44f6f8f 100644
--- a/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb
+++ b/spec/lib/gitlab/database/migrations/test_batched_background_runner_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freeze_time do
include Gitlab::Database::MigrationHelpers
- include Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers
include Database::MigrationTestingHelpers
let(:result_dir) { Dir.mktmpdir }
@@ -13,6 +12,10 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
FileUtils.rm_rf(result_dir)
end
+ let(:migration) do
+ ActiveRecord::Migration.new.extend(Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers)
+ end
+
let(:connection) { ApplicationRecord.connection }
let(:table_name) { "_test_column_copying"}
@@ -26,11 +29,13 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
insert into #{table_name} (id) select i from generate_series(1, 1000) g(i);
SQL
+
+ allow(migration).to receive(:transaction_open?).and_return(false)
end
context 'running a real background migration' do
it 'runs sampled jobs from the batched background migration' do
- queue_batched_background_migration('CopyColumnUsingBackgroundMigrationJob',
+ migration.queue_batched_background_migration('CopyColumnUsingBackgroundMigrationJob',
table_name, :id,
:id, :data,
batch_size: 100,
@@ -46,7 +51,9 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
let(:migration_name) { 'TestBackgroundMigration' }
before do
- queue_batched_background_migration(migration_name, table_name, :id, job_interval: 5.minutes, batch_size: 100)
+ migration.queue_batched_background_migration(
+ migration_name, table_name, :id, job_interval: 5.minutes, batch_size: 100
+ )
end
it 'samples jobs' do
@@ -67,13 +74,13 @@ RSpec.describe Gitlab::Database::Migrations::TestBatchedBackgroundRunner, :freez
travel 3.days
new_migration = define_background_migration('NewMigration') { travel 1.second }
- queue_batched_background_migration('NewMigration', table_name, :id,
+ migration.queue_batched_background_migration('NewMigration', table_name, :id,
job_interval: 5.minutes,
batch_size: 10,
sub_batch_size: 5)
other_new_migration = define_background_migration('NewMigration2') { travel 2.seconds }
- queue_batched_background_migration('NewMigration2', table_name, :id,
+ migration.queue_batched_background_migration('NewMigration2', table_name, :id,
job_interval: 5.minutes,
batch_size: 10,
sub_batch_size: 5)
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 62c1da8c990..9b1cfeac4c5 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -336,6 +336,8 @@ integrations:
- jira_tracker_data
- zentao_tracker_data
- issue_tracker_data
+# dingtalk_tracker_data JiHu-specific, see https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/417
+- dingtalk_tracker_data
hooks:
- project
- web_hook_logs
@@ -414,6 +416,8 @@ project:
- pushover_integration
- jira_integration
- zentao_integration
+# dingtalk_integration JiHu-specific, see https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/417
+- dingtalk_integration
- redmine_integration
- youtrack_integration
- custom_issue_tracker_integration
diff --git a/spec/models/preloaders/user_max_access_level_in_projects_preloader_spec.rb b/spec/models/preloaders/user_max_access_level_in_projects_preloader_spec.rb
index eefe5bfc6c4..7d4268f74e9 100644
--- a/spec/models/preloaders/user_max_access_level_in_projects_preloader_spec.rb
+++ b/spec/models/preloaders/user_max_access_level_in_projects_preloader_spec.rb
@@ -7,8 +7,10 @@ RSpec.describe Preloaders::UserMaxAccessLevelInProjectsPreloader do
let_it_be(:project_1) { create(:project) }
let_it_be(:project_2) { create(:project) }
let_it_be(:project_3) { create(:project) }
+ let_it_be(:project_4) { create(:project) }
+ let_it_be(:project_5) { create(:project) }
- let(:projects) { [project_1, project_2, project_3] }
+ let(:projects) { [project_1, project_2, project_3, project_4, project_5] }
let(:query) { projects.each { |project| user.can?(:read_project, project) } }
before do
@@ -17,8 +19,11 @@ RSpec.describe Preloaders::UserMaxAccessLevelInProjectsPreloader do
end
context 'without preloader' do
- it 'runs N queries' do
- expect { query }.to make_queries(projects.size)
+ it 'runs some queries' do
+ # we have an existing N+1, one for each project for which user is not a member
+ # in this spec, project_3, project_4, project_5
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/362890
+ expect { query }.to make_queries(projects.size + 3)
end
end
@@ -34,7 +39,7 @@ RSpec.describe Preloaders::UserMaxAccessLevelInProjectsPreloader do
end
context 'when projects is an array of IDs' do
- let(:projects_arg) { [project_1.id, project_2.id, project_3.id] }
+ let(:projects_arg) { projects.map(&:id) }
it 'avoids N+1 queries' do
expect { query }.not_to make_queries
diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb
index ca4ca2eb7a0..ce97fc0c77e 100644
--- a/spec/policies/project_policy_spec.rb
+++ b/spec/policies/project_policy_spec.rb
@@ -433,6 +433,80 @@ RSpec.describe ProjectPolicy do
end
end
+ context 'owner access' do
+ let!(:owner_user) { create(:user) }
+ let!(:owner_of_different_thing) { create(:user) }
+ let(:stranger) { create(:user) }
+
+ shared_examples 'owner access for personal and group projects' do
+ before do
+ stub_feature_flags(faster_owner_access: faster_owner_access_enabled)
+ end
+
+ context 'personal project' do
+ let!(:project) { create(:project) }
+ let!(:project2) { create(:project) }
+
+ before do
+ project.add_guest(guest)
+ project.add_reporter(reporter)
+ project.add_developer(developer)
+ project.add_maintainer(maintainer)
+ project2.add_owner(owner_of_different_thing)
+ end
+
+ it 'allows owner access', :aggregate_failures do
+ expect(described_class.new(owner_of_different_thing, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(stranger, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(guest, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(reporter, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(developer, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(maintainer, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(project.owner, project)).to be_allowed(:owner_access)
+ end
+ end
+
+ context 'group project' do
+ let(:group) { create(:group) }
+ let!(:group2) { create(:group) }
+ let!(:project) { create(:project, group: group) }
+
+ context 'group members' do
+ before do
+ group.add_guest(guest)
+ group.add_reporter(reporter)
+ group.add_developer(developer)
+ group.add_maintainer(maintainer)
+ group.add_owner(owner_user)
+ group2.add_owner(owner_of_different_thing)
+ end
+
+ it 'allows owner access', :aggregate_failures do
+ expect(described_class.new(owner_of_different_thing, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(stranger, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(guest, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(reporter, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(developer, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(maintainer, project)).to be_disallowed(:owner_access)
+ expect(described_class.new(owner_user, project)).to be_allowed(:owner_access)
+ end
+ end
+ end
+ end
+
+ context 'when faster_owner_access feature is enabled' do
+ let(:faster_owner_access_enabled) { true }
+
+ it_behaves_like 'owner access for personal and group projects'
+ end
+
+ context 'when faster_owner_access feature is not enabled' do
+ let(:faster_owner_access_enabled) { false }
+
+ it_behaves_like 'owner access for personal and group projects'
+ end
+ end
+
context 'reading a project' do
it 'allows access when a user has read access to the repo' do
expect(described_class.new(owner, project)).to be_allowed(:read_project)
diff --git a/spec/services/notification_recipients/build_service_spec.rb b/spec/services/notification_recipients/build_service_spec.rb
index ff54d6ccd2f..b348d95ecfc 100644
--- a/spec/services/notification_recipients/build_service_spec.rb
+++ b/spec/services/notification_recipients/build_service_spec.rb
@@ -14,6 +14,9 @@ RSpec.describe NotificationRecipients::BuildService do
shared_examples 'no N+1 queries' do
it 'avoids N+1 queries', :request_store do
+ # existing N+1 due to multiple users having to be looked up in the project_authorizations table
+ threshold = Feature.enabled?(:faster_owner_access) && project.private? ? 1 : 0
+
create_user
service.build_new_note_recipients(note)
@@ -24,37 +27,46 @@ RSpec.describe NotificationRecipients::BuildService do
create_user
- expect { service.build_new_note_recipients(note) }.not_to exceed_query_limit(control_count)
+ expect { service.build_new_note_recipients(note) }.not_to exceed_query_limit(control_count).with_threshold(threshold)
end
end
- context 'when there are multiple watchers' do
- def create_user
- watcher = create(:user)
- create(:notification_setting, source: project, user: watcher, level: :watch)
+ [true, false].each do |value|
+ context "when faster_owner_access feature is #{value ? 'enabled' : 'not enabled'}" do
+ before do
+ # test both feature flag values
+ stub_feature_flags(faster_owner_access: value)
+ end
+
+ context 'when there are multiple watchers' do
+ def create_user
+ watcher = create(:user)
+ create(:notification_setting, source: project, user: watcher, level: :watch)
+
+ other_projects.each do |other_project|
+ create(:notification_setting, source: other_project, user: watcher, level: :watch)
+ end
+ end
- other_projects.each do |other_project|
- create(:notification_setting, source: other_project, user: watcher, level: :watch)
+ include_examples 'no N+1 queries'
end
- end
- include_examples 'no N+1 queries'
- end
+ context 'when there are multiple subscribers' do
+ def create_user
+ subscriber = create(:user)
+ issue.subscriptions.create!(user: subscriber, project: project, subscribed: true)
+ end
- context 'when there are multiple subscribers' do
- def create_user
- subscriber = create(:user)
- issue.subscriptions.create!(user: subscriber, project: project, subscribed: true)
- end
+ include_examples 'no N+1 queries'
- include_examples 'no N+1 queries'
+ context 'when the project is private' do
+ before do
+ project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ end
- context 'when the project is private' do
- before do
- project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ include_examples 'no N+1 queries'
+ end
end
-
- include_examples 'no N+1 queries'
end
end
end
@@ -66,6 +78,9 @@ RSpec.describe NotificationRecipients::BuildService do
shared_examples 'no N+1 queries' do
it 'avoids N+1 queries', :request_store do
+ # existing N+1 due to multiple users having to be looked up in the project_authorizations table
+ threshold = Feature.enabled?(:faster_owner_access) && project.private? ? 1 : 0
+
create_user
service.build_new_review_recipients(review)
@@ -76,37 +91,46 @@ RSpec.describe NotificationRecipients::BuildService do
create_user
- expect { service.build_new_review_recipients(review) }.not_to exceed_query_limit(control_count)
+ expect { service.build_new_review_recipients(review) }.not_to exceed_query_limit(control_count).with_threshold(threshold)
end
end
- context 'when there are multiple watchers' do
- def create_user
- watcher = create(:user)
- create(:notification_setting, source: project, user: watcher, level: :watch)
+ [true, false].each do |value|
+ context "when faster_owner_access feature is #{value ? 'enabled' : 'not enabled'}" do
+ before do
+ # test both feature flag values
+ stub_feature_flags(faster_owner_access: value)
+ end
+
+ context 'when there are multiple watchers' do
+ def create_user
+ watcher = create(:user)
+ create(:notification_setting, source: project, user: watcher, level: :watch)
+
+ other_projects.each do |other_project|
+ create(:notification_setting, source: other_project, user: watcher, level: :watch)
+ end
+ end
- other_projects.each do |other_project|
- create(:notification_setting, source: other_project, user: watcher, level: :watch)
+ include_examples 'no N+1 queries'
end
- end
- include_examples 'no N+1 queries'
- end
+ context 'when there are multiple subscribers' do
+ def create_user
+ subscriber = create(:user)
+ merge_request.subscriptions.create!(user: subscriber, project: project, subscribed: true)
+ end
- context 'when there are multiple subscribers' do
- def create_user
- subscriber = create(:user)
- merge_request.subscriptions.create!(user: subscriber, project: project, subscribed: true)
- end
+ include_examples 'no N+1 queries'
- include_examples 'no N+1 queries'
+ context 'when the project is private' do
+ before do
+ project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ end
- context 'when the project is private' do
- before do
- project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ include_examples 'no N+1 queries'
+ end
end
-
- include_examples 'no N+1 queries'
end
end
end
diff --git a/yarn.lock b/yarn.lock
index 236523c3625..ec40f4c9d19 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1545,10 +1545,10 @@
dom-accessibility-api "^0.5.1"
pretty-format "^26.4.2"
-"@tiptap/core@^2.0.0-beta.175":
- version "2.0.0-beta.175"
- resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.0.0-beta.175.tgz#d23f6e60308cde192451121e21df83c256bdcd92"
- integrity sha512-dDf+2GtifskNLysn49kaCIz0o5hf6VDZ8J7jSQAfoPDEkEkfw9OKhWrR7NzWW6J34CSJreFDRiWkGt8Qz283Vg==
+"@tiptap/core@^2.0.0-beta.176":
+ version "2.0.0-beta.176"
+ resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.0.0-beta.176.tgz#a8bb9b57d2ecf77b6cd02340324626ef3e336a15"
+ integrity sha512-Gs/+yUYTNpt8PnclEHbfBnY56D/9PpKTyzrg8VZwCFK9S69aVD2dqLsYs/Gn+EjzKImXRAiqSe1/FWcNEDkmCg==
dependencies:
"@types/prosemirror-commands" "^1.0.4"
"@types/prosemirror-keymap" "^1.0.4"
@@ -1678,10 +1678,10 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-italic/-/extension-italic-2.0.0-beta.26.tgz#b00c9e32b81b1bd94eaed24bb2a22e44d5dc54a3"
integrity sha512-vejGe2ra4K5ipFOn1U9viqF9X9nPTX8WSJpSOux+9UbKjHpANy7bz69tp66OIi/Wh5L/MMDc+luH/04qfVnpZw==
-"@tiptap/extension-link@^2.0.0-beta.37":
- version "2.0.0-beta.37"
- resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.0.0-beta.37.tgz#8d569284b82860e6a9aac42b85ed9c0911e50599"
- integrity sha512-G5sM1a8Kjm1ZMro+BGsk+yApIDMl7RF/u1PY929HHld7JPsjgB+DZbbQ1U7e9Kxiu/9aDwgOa+w+SLqLiajedw==
+"@tiptap/extension-link@^2.0.0-beta.38":
+ version "2.0.0-beta.38"
+ resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.0.0-beta.38.tgz#e7fb0ebee0d557ef921bf3c7fa6a7c62335f66a5"
+ integrity sha512-j+ygwq3cpDu5/8zPBcHyfgC5cuyO3jfV+2KcJw2I6Qi73y4Kwo3PW/leEYlSHkIt7i1zjyFHo/oDfC4K9x9eQg==
dependencies:
linkifyjs "^3.0.5"
prosemirror-model "^1.16.1"
@@ -1732,11 +1732,15 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-table-row/-/extension-table-row-2.0.0-beta.19.tgz#b45e82f29dfcc7405440ba237b069dbb93d1a94a"
integrity sha512-ldEVDpIUX7ZqbViTy4c/RfyNGRv++O/r3A/Ivuon1PykaDDTbPlp5JM89FunAD39cLAbo2HKtweqdmzCMlZsqA==
-"@tiptap/extension-table@^2.0.0-beta.48":
- version "2.0.0-beta.48"
- resolved "https://registry.yarnpkg.com/@tiptap/extension-table/-/extension-table-2.0.0-beta.48.tgz#4b6adfe358fd38199ef5b29dafc9425fd461d1b3"
- integrity sha512-Hcx3kOBQyazQ3dV0Oq4zKIl1og4EqUuZ5nEWxwcb8HgxSUYIhAJQ7pujPZiRLfkoFy92oVwmh9KhBRfQqRkUpQ==
+"@tiptap/extension-table@^2.0.0-beta.49":
+ version "2.0.0-beta.49"
+ resolved "https://registry.yarnpkg.com/@tiptap/extension-table/-/extension-table-2.0.0-beta.49.tgz#10e2fbc204290ae39b6768c9247f6aaced666776"
+ integrity sha512-7irrvMUe9z/6Y8DcFwSuxaIVQ71VUUT1xxv6NZADvdf0HJWesCaTpVORISTnNuQdO5nwEyJXXJ5Ri/82YzWe0g==
dependencies:
+ "@types/prosemirror-model" "^1.16.0"
+ "@types/prosemirror-state" "^1.2.8"
+ prosemirror-model "^1.16.1"
+ prosemirror-state "^1.3.4"
prosemirror-tables "^1.1.1"
prosemirror-view "^1.23.6"
@@ -1755,10 +1759,10 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.0.0-beta.15.tgz#f08cff1b78f1c6996464dfba1fef8ec1e107617f"
integrity sha512-S3j2+HyV2gsXZP8Wg/HA+YVXQsZ3nrXgBM9HmGAxB0ESOO50l7LWfip0f3qcw1oRlh5H3iLPkA6/f7clD2/TFA==
-"@tiptap/vue-2@^2.0.0-beta.78":
- version "2.0.0-beta.78"
- resolved "https://registry.yarnpkg.com/@tiptap/vue-2/-/vue-2-2.0.0-beta.78.tgz#34c5aea2be46914026d8d58638761f1a46b3dc88"
- integrity sha512-YTgKk7qCTu+odAwEzAseAdE1apYZL4OU3dRvtZ/WAXrs0NpV4H33cjSNx/MqNxdclQEbCPwMj/cRybDuYu0atQ==
+"@tiptap/vue-2@^2.0.0-beta.79":
+ version "2.0.0-beta.79"
+ resolved "https://registry.yarnpkg.com/@tiptap/vue-2/-/vue-2-2.0.0-beta.79.tgz#8192fc56b083097559f8158a177f76572ecfabf1"
+ integrity sha512-dwprmBVRvPJl0gMgH6LBU79yqhTbjiDQ3ReNtZ+MFBqwujQfkAqnsm6VVgLjd4jHsV+nzblP5HPH8s9MhIdySw==
dependencies:
"@tiptap/extension-bubble-menu" "^2.0.0-beta.56"
"@tiptap/extension-floating-menu" "^2.0.0-beta.51"