diff --git a/app/assets/stylesheets/snippets.scss b/app/assets/stylesheets/snippets.scss index d38c1818f53..f79237eee3d 100644 --- a/app/assets/stylesheets/snippets.scss +++ b/app/assets/stylesheets/snippets.scss @@ -33,6 +33,10 @@ text-align: left; } + .file-holder { + margin: 0; + } + .file-content.code { border: $border-style; border-radius: 0 0 $border-radius-default $border-radius-default; diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index e04e68102ed..d7d15f8c1c7 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -135,9 +135,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo set_pipeline_variables - ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336891') do - @number_of_pipelines = @pipelines.size - end + @number_of_pipelines = @pipelines.size render end @@ -201,17 +199,15 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo Gitlab::PollingInterval.set_header(response, interval: 10_000) - ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336891') do - render json: { - pipelines: PipelineSerializer - .new(project: @project, current_user: @current_user) - .with_pagination(request, response) - .represent(@pipelines), - count: { - all: @pipelines.count - } + render json: { + pipelines: PipelineSerializer + .new(project: @project, current_user: @current_user) + .with_pagination(request, response) + .represent(@pipelines), + count: { + all: @pipelines.count } - end + } end def sast_reports diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index e4608b26339..f4cac56fdd7 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1409,9 +1409,7 @@ class MergeRequest < ApplicationRecord def has_ci? return false if has_no_commits? - ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336891') do - !!(head_pipeline_id || all_pipelines.any? || source_project&.ci_integration) - end + !!(head_pipeline_id || all_pipelines.any? || source_project&.ci_integration) end def branch_missing? @@ -1912,9 +1910,7 @@ class MergeRequest < ApplicationRecord end def find_actual_head_pipeline - ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336891') do - all_pipelines.for_sha_or_source_sha(diff_head_sha).first - end + all_pipelines.for_sha_or_source_sha(diff_head_sha).first end def etag_caching_enabled? diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 596f5f2d93f..03115416607 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -539,6 +539,9 @@ class IssuableBaseService < ::BaseProjectService def handle_label_changes(issuable, old_labels) return unless has_label_changes?(issuable, old_labels) + # reset to preserve the label sort order (title ASC) + issuable.labels.reset + GraphqlTriggers.issuable_labels_updated(issuable) end diff --git a/config/feature_flags/development/track_editor_edit_actions.yml b/config/feature_flags/development/track_editor_edit_actions.yml deleted file mode 100644 index d73307231a2..00000000000 --- a/config/feature_flags/development/track_editor_edit_actions.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: track_editor_edit_actions -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39694 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/240928 -milestone: '13.4' -type: development -group: group::editor -default_enabled: true diff --git a/config/feature_flags/development/mrc_api_use_raw_diffs_from_gitaly.yml b/config/feature_flags/development/use_api_for_payment_validation.yml similarity index 61% rename from config/feature_flags/development/mrc_api_use_raw_diffs_from_gitaly.yml rename to config/feature_flags/development/use_api_for_payment_validation.yml index a75824d3c24..f57df08a2b0 100644 --- a/config/feature_flags/development/mrc_api_use_raw_diffs_from_gitaly.yml +++ b/config/feature_flags/development/use_api_for_payment_validation.yml @@ -1,8 +1,8 @@ --- -name: mrc_api_use_raw_diffs_from_gitaly -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46190 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/225322 +name: use_api_for_payment_validation +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84292 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/357282 +milestone: '14.10' type: development -group: group::code review +group: group::purchase default_enabled: false -milestone: '13.6' diff --git a/doc/api/commits.md b/doc/api/commits.md index d7be9559527..7be5bc3d985 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -49,11 +49,11 @@ Example response: "title": "Replace sanitize with escape once", "author_name": "Example User", "author_email": "user@example.com", - "authored_date": "2012-09-20T11:50:22+03:00", + "authored_date": "2021-09-20T11:50:22.001+00:00", "committer_name": "Administrator", "committer_email": "admin@example.com", - "committed_date": "2012-09-20T11:50:22+03:00", - "created_at": "2012-09-20T11:50:22+03:00", + "committed_date": "2021-09-20T11:50:22.001+00:00", + "created_at": "2021-09-20T11:50:22.001+00:00", "message": "Replace sanitize with escape once", "parent_ids": [ "6104942438c14ec7bd21c6cd5bd995272b3faff6" @@ -68,7 +68,7 @@ Example response: "author_email": "user@example.com", "committer_name": "ExampleName", "committer_email": "user@example.com", - "created_at": "2012-09-20T09:06:12+03:00", + "created_at": "2021-09-20T09:06:12.201+00:00", "message": "Sanitize for network graph", "parent_ids": [ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" @@ -234,10 +234,10 @@ Example response: "author_email": "user@example.com", "committer_name": "Dmitriy", "committer_email": "user@example.com", - "created_at": "2012-09-20T09:06:12+03:00", + "created_at": "2021-09-20T09:06:12.300+03:00", "message": "Sanitize for network graph", - "committed_date": "2012-09-20T09:06:12+03:00", - "authored_date": "2012-09-20T09:06:12+03:00", + "committed_date": "2021-09-20T09:06:12.300+03:00", + "authored_date": "2021-09-20T09:06:12.420+03:00", "parent_ids": [ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" ], diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 292dc9f09a8..782d52cfbc7 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -4962,11 +4962,11 @@ Input type: `UpdateIterationInput` | ---- | ---- | ----------- | | `clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | `description` | [`String`](#string) | Description of the iteration. | -| `dueDate` | [`String`](#string) | End date of the iteration. | +| `dueDate` **{warning-solid}** | [`String`](#string) | **Deprecated:** Manual iteration updates are deprecated, only `description` updates will be allowed in the future. Deprecated in 14.10. | | `groupPath` | [`ID!`](#id) | Group of the iteration. | | `id` | [`ID!`](#id) | Global ID of the iteration. | -| `startDate` | [`String`](#string) | Start date of the iteration. | -| `title` | [`String`](#string) | Title of the iteration. | +| `startDate` **{warning-solid}** | [`String`](#string) | **Deprecated:** Manual iteration updates are deprecated, only `description` updates will be allowed in the future. Deprecated in 14.10. | +| `title` **{warning-solid}** | [`String`](#string) | **Deprecated:** Manual iteration updates are deprecated, only `description` updates will be allowed in the future. Deprecated in 14.10. | #### Fields diff --git a/doc/ci/yaml/artifacts_reports.md b/doc/ci/yaml/artifacts_reports.md index bd28d917cd7..7ea26d4f209 100644 --- a/doc/ci/yaml/artifacts_reports.md +++ b/doc/ci/yaml/artifacts_reports.md @@ -87,7 +87,7 @@ GitLab can display the results of one or more reports in: WARNING: This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78132) for use in GitLab -14.8 and replaced with `artifacts:reports:coverage_report`. +14.9 and replaced with `artifacts:reports:coverage_report` in 14.10. The `cobertura` report collects [Cobertura coverage XML files](../../user/project/merge_requests/test_coverage_visualization.md). The collected Cobertura coverage reports upload to GitLab as an artifact. diff --git a/lib/api/entities/merge_request_changes.rb b/lib/api/entities/merge_request_changes.rb index 488f33dfb93..a1e8b5ae00a 100644 --- a/lib/api/entities/merge_request_changes.rb +++ b/lib/api/entities/merge_request_changes.rb @@ -24,7 +24,7 @@ module API end def expose_raw_diffs? - options[:access_raw_diffs] || ::Feature.enabled?(:mrc_api_use_raw_diffs_from_gitaly, options[:project]) + options[:access_raw_diffs] end end end diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index fdf4bc58525..685362bea5a 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -25,25 +25,21 @@ redis_slot: edit expiry: 29 aggregation: daily - feature_flag: track_editor_edit_actions - name: g_edit_by_sfe category: ide_edit redis_slot: edit expiry: 29 aggregation: daily - feature_flag: track_editor_edit_actions - name: g_edit_by_sse category: ide_edit redis_slot: edit expiry: 29 aggregation: daily - feature_flag: track_editor_edit_actions - name: g_edit_by_snippet_ide category: ide_edit redis_slot: edit expiry: 29 aggregation: daily - feature_flag: track_editor_edit_actions - name: i_search_total category: search redis_slot: search diff --git a/spec/requests/api/graphql/mutations/issues/update_spec.rb b/spec/requests/api/graphql/mutations/issues/update_spec.rb index 0f2eeb90894..f38deb426b1 100644 --- a/spec/requests/api/graphql/mutations/issues/update_spec.rb +++ b/spec/requests/api/graphql/mutations/issues/update_spec.rb @@ -8,8 +8,8 @@ RSpec.describe 'Update of an existing issue' do let_it_be(:current_user) { create(:user) } let_it_be(:project) { create(:project, :public) } let_it_be(:issue) { create(:issue, project: project) } - let_it_be(:label1) { create(:label, project: project) } - let_it_be(:label2) { create(:label, project: project) } + let_it_be(:label1) { create(:label, title: "a", project: project) } + let_it_be(:label2) { create(:label, title: "b", project: project) } let(:input) do { @@ -124,7 +124,7 @@ RSpec.describe 'Update of an existing issue' do context 'add and remove labels' do let(:input_params) { input.merge(extra_params).merge({ addLabelIds: [label1.id], removeLabelIds: [label2.id] }) } - it 'returns error for mutually exclusive arguments' do + it 'returns correct labels' do post_graphql_mutation(mutation, current_user: current_user) expect(response).to have_gitlab_http_status(:success) @@ -132,6 +132,22 @@ RSpec.describe 'Update of an existing issue' do expect(mutation_response['issue']['labels']).to include({ "nodes" => [{ "id" => label1.to_global_id.to_s }] }) end end + + context 'add labels' do + let(:input_params) { input.merge(extra_params).merge({ addLabelIds: [label1.id] }) } + + before do + issue.update!({ labels: [label2] }) + end + + it 'adds labels and keeps the title ordering' do + post_graphql_mutation(mutation, current_user: current_user) + + expect(response).to have_gitlab_http_status(:success) + expect(json_response['errors']).to be_nil + expect(mutation_response['issue']['labels']['nodes']).to eq([{ "id" => label1.to_global_id.to_s }, { "id" => label2.to_global_id.to_s }]) + end + end end end end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb index 0d0cc66c52a..e40a3cf7ce9 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb @@ -8,8 +8,8 @@ RSpec.describe 'Setting labels of a merge request' do let(:current_user) { create(:user) } let(:merge_request) { create(:merge_request) } let(:project) { merge_request.project } - let(:label) { create(:label, project: project) } - let(:label2) { create(:label, project: project) } + let(:label) { create(:label, title: "a", project: project) } + let(:label2) { create(:label, title: "b", project: project) } let(:input) { { label_ids: [GitlabSchema.id_from_object(label).to_s] } } let(:mutation) do @@ -81,12 +81,12 @@ RSpec.describe 'Setting labels of a merge request' do merge_request.update!(labels: [label2]) end - it 'sets the labels, without removing others' do + it 'sets the labels and resets labels to keep the title ordering, without removing others' do post_graphql_mutation(mutation, current_user: current_user) expect(response).to have_gitlab_http_status(:success) expect(mutation_label_nodes.count).to eq(2) - expect(mutation_label_nodes).to contain_exactly({ 'id' => label.to_global_id.to_s }, { 'id' => label2.to_global_id.to_s }) + expect(mutation_label_nodes).to eq([{ 'id' => label.to_global_id.to_s }, { 'id' => label2.to_global_id.to_s }]) end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 9e6fea9e5b4..b1183bb10fa 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -1605,11 +1605,7 @@ RSpec.describe API::MergeRequests do expect(json_response['overflow']).to be_falsy end - context 'when using DB-backed diffs via feature flag' do - before do - stub_feature_flags(mrc_api_use_raw_diffs_from_gitaly: false) - end - + context 'when using DB-backed diffs' do it_behaves_like 'find an existing merge request' it 'accesses diffs via DB-backed diffs.diffs' do diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 617005a9d53..d496857bb25 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -9,8 +9,8 @@ RSpec.describe Issues::UpdateService, :mailer do let_it_be(:guest) { create(:user) } let_it_be(:group) { create(:group, :public, :crm_enabled) } let_it_be(:project, reload: true) { create(:project, :repository, group: group) } - let_it_be(:label) { create(:label, project: project) } - let_it_be(:label2) { create(:label, project: project) } + let_it_be(:label) { create(:label, title: 'a', project: project) } + let_it_be(:label2) { create(:label, title: 'b', project: project) } let_it_be(:milestone) { create(:milestone, project: project) } let(:issue) do @@ -1361,11 +1361,14 @@ RSpec.describe Issues::UpdateService, :mailer do end end - it_behaves_like 'broadcasting issuable labels updates' do + context 'labels are updated' do let(:label_a) { label } let(:label_b) { label2 } let(:issuable) { issue } + it_behaves_like 'keeps issuable labels sorted after update' + it_behaves_like 'broadcasting issuable labels updates' + def update_issuable(update_params) update_issue(update_params) end diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index b73e8dda504..30095ebeb50 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -10,7 +10,7 @@ RSpec.describe MergeRequests::UpdateService, :mailer do let(:user) { create(:user) } let(:user2) { create(:user) } let(:user3) { create(:user) } - let(:label) { create(:label, project: project) } + let(:label) { create(:label, title: 'a', project: project) } let(:label2) { create(:label) } let(:milestone) { create(:milestone, project: project) } @@ -1193,11 +1193,14 @@ RSpec.describe MergeRequests::UpdateService, :mailer do let(:issuable) { described_class.new(project: project, current_user: user, params: params).execute(existing_merge_request) } end - it_behaves_like 'broadcasting issuable labels updates' do + context 'labels are updated' do let(:label_a) { label } - let(:label_b) { create(:label, project: project) } + let(:label_b) { create(:label, title: 'b', project: project) } let(:issuable) { merge_request } + it_behaves_like 'keeps issuable labels sorted after update' + it_behaves_like 'broadcasting issuable labels updates' + def update_issuable(update_params) update_merge_request(update_params) end diff --git a/spec/support/services/issuable_update_service_shared_examples.rb b/spec/support/services/issuable_update_service_shared_examples.rb index b0e279b9601..c168df7a7d2 100644 --- a/spec/support/services/issuable_update_service_shared_examples.rb +++ b/spec/support/services/issuable_update_service_shared_examples.rb @@ -24,6 +24,20 @@ RSpec.shared_examples 'issuable update service' do end end +RSpec.shared_examples 'keeps issuable labels sorted after update' do + before do + update_issuable(label_ids: [label_b.id]) + end + + context 'when label is changed' do + it 'keeps the labels sorted by title ASC' do + update_issuable({ add_label_ids: [label_a.id] }) + + expect(issuable.labels).to eq([label_a, label_b]) + end + end +end + RSpec.shared_examples 'broadcasting issuable labels updates' do before do update_issuable(label_ids: [label_a.id])