Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-04-06 06:08:32 +00:00
parent 5018d96853
commit 284b0a53bc
17 changed files with 85 additions and 66 deletions

View File

@ -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;

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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"
],

View File

@ -4962,11 +4962,11 @@ Input type: `UpdateIterationInput`
| ---- | ---- | ----------- |
| <a id="mutationupdateiterationclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationupdateiterationdescription"></a>`description` | [`String`](#string) | Description of the iteration. |
| <a id="mutationupdateiterationduedate"></a>`dueDate` | [`String`](#string) | End date of the iteration. |
| <a id="mutationupdateiterationduedate"></a>`dueDate` **{warning-solid}** | [`String`](#string) | **Deprecated:** Manual iteration updates are deprecated, only `description` updates will be allowed in the future. Deprecated in 14.10. |
| <a id="mutationupdateiterationgrouppath"></a>`groupPath` | [`ID!`](#id) | Group of the iteration. |
| <a id="mutationupdateiterationid"></a>`id` | [`ID!`](#id) | Global ID of the iteration. |
| <a id="mutationupdateiterationstartdate"></a>`startDate` | [`String`](#string) | Start date of the iteration. |
| <a id="mutationupdateiterationtitle"></a>`title` | [`String`](#string) | Title of the iteration. |
| <a id="mutationupdateiterationstartdate"></a>`startDate` **{warning-solid}** | [`String`](#string) | **Deprecated:** Manual iteration updates are deprecated, only `description` updates will be allowed in the future. Deprecated in 14.10. |
| <a id="mutationupdateiterationtitle"></a>`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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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])