Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-08-25 21:10:28 +00:00
parent b98791fe50
commit 52f765baf4
34 changed files with 81 additions and 76 deletions

View File

@ -233,7 +233,7 @@ export function insertMarkdownText({
}
} else if (tag.indexOf(textPlaceholder) > -1) {
textToInsert = tag.replace(textPlaceholder, () =>
selected.replace(/\\n/g, '\n').replace(/\/(n|t|r)/g, '\\$1'),
selected.replace(/\\n/g, '\n').replace('%br', '\\n'),
);
} else {
textToInsert = String(startChar) + tag + selected + (wrap ? tag : '');

View File

@ -7,7 +7,7 @@ import ProjectPipelinesCharts from './components/app.vue';
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
});
const mountPipelineChartsApp = (el) => {

View File

@ -16,11 +16,7 @@ import MarkdownHeader from './header.vue';
import MarkdownToolbar from './toolbar.vue';
function cleanUpLine(content) {
return unescape(
stripHtml(content)
.replace(/\\(n|t|r)/g, '/$1')
.replace(/\n/g, ''),
);
return unescape(stripHtml(content).replace(/\\n/g, '%br').replace(/\n/g, ''));
}
export default {

View File

@ -30,6 +30,13 @@ module Resolvers
required: false,
description: 'Type of the todo.'
before_connection_authorization do |nodes, current_user|
Preloaders::UserMaxAccessLevelInProjectsPreloader.new(
nodes.map(&:project).compact,
current_user
).execute
end
def resolve(**args)
return Todo.none unless current_user.present? && target.present?
return Todo.none if target.is_a?(User) && target != current_user

View File

@ -115,9 +115,7 @@ module Types
null: true,
description: 'Runbook for the alert as defined in alert details.'
field :todos, description: 'To-do items of the current user for the alert.', resolver: Resolvers::TodoResolver do
extension(::Gitlab::Graphql::TodosProjectPermissionPreloader::FieldExtension)
end
field :todos, description: 'To-do items of the current user for the alert.', resolver: Resolvers::TodoResolver
field :details_url,
GraphQL::Types::String,

View File

@ -85,9 +85,7 @@ module Types
null: true,
description: 'Personal namespace of the user.'
field :todos, resolver: Resolvers::TodoResolver, description: 'To-do items of the user.' do
extension(::Gitlab::Graphql::TodosProjectPermissionPreloader::FieldExtension)
end
field :todos, resolver: Resolvers::TodoResolver, description: 'To-do items of the user.'
# Merge request field: MRs can be authored, assigned, or assigned-for-review:
field :authored_merge_requests,

View File

@ -33,4 +33,4 @@
.form-text.text-muted
= _('AWS Secret Access Key. Only required if not using role instance credentials')
= f.submit 'Save changes', class: "gl-button btn btn-confirm"
= f.submit _('Save changes'), class: "gl-button btn btn-confirm"

View File

@ -47,4 +47,4 @@
.form-group
= f.label :external_authorization_service_default_label, _('Default classification label'), class: 'label-bold'
= f.text_field :external_authorization_service_default_label, class: 'form-control gl-form-input'
= f.submit 'Save changes', class: "gl-button btn btn-confirm"
= f.submit _('Save changes'), class: "gl-button btn btn-confirm"

View File

@ -19,4 +19,4 @@
.form-check
= f.check_box :floc_enabled, class: 'form-check-input'
= f.label :floc_enabled, s_('FloC|Enable FloC (Federated Learning of Cohorts)'), class: 'form-check-label'
= f.submit s_('Save changes'), class: 'gl-button btn btn-confirm'
= f.submit _('Save changes'), class: 'gl-button btn btn-confirm'

View File

@ -27,4 +27,4 @@
= s_('Gitpod|The URL to your Gitpod instance configured to read your GitLab projects, such as https://gitpod.example.com.')
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('integration/gitpod', anchor: 'enable-gitpod-in-your-user-settings') }
= s_('Gitpod|To use the integration, each user must also enable Gitpod on their GitLab account. %{link_start}How do I enable it?%{link_end} ').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
= f.submit s_('Save changes'), class: 'gl-button btn btn-confirm'
= f.submit _('Save changes'), class: 'gl-button btn btn-confirm'

View File

@ -31,4 +31,4 @@
= f.label :group_download_export_limit, _('Max Group Export Download requests per minute per user'), class: 'label-bold'
= f.number_field :group_download_export_limit, class: 'form-control gl-form-input'
= f.submit 'Save changes', class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }

View File

@ -6,4 +6,4 @@
= f.label :issues_create_limit, 'Max requests per minute per user', class: 'label-bold'
= f.number_field :issues_create_limit, class: 'form-control gl-form-input'
= f.submit 'Save changes', class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }

View File

@ -27,4 +27,4 @@
%span.form-text.text-muted
= _('Resolves IP addresses once and uses them to submit requests')
= f.submit 'Save changes', class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }

View File

@ -34,4 +34,4 @@
= f.label :throttle_authenticated_packages_api_period_in_seconds, 'Authenticated API rate limit period in seconds', class: 'label-bold'
= f.number_field :throttle_authenticated_packages_api_period_in_seconds, class: 'form-control gl-form-input'
= f.submit 'Save changes', class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }

View File

@ -28,4 +28,4 @@
= _('All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URL%{relative_url_link_end}.').html_safe % { relative_url_link_start: relative_url_link_start, relative_url_link_end: '</a>'.html_safe }
= f.text_area :protected_paths_raw, placeholder: '/users/sign_in,/users/password', class: 'form-control gl-form-input', rows: 10
= f.submit 'Save changes', class: 'gl-button btn btn-confirm'
= f.submit _('Save changes'), class: 'gl-button btn btn-confirm'

View File

@ -10,7 +10,7 @@
= form_for [@project, @hook], as: :hook, url: project_hook_path(@project, @hook) do |f|
= render partial: 'shared/web_hooks/form', locals: { form: f, hook: @hook }
= f.submit 'Save changes', class: 'btn gl-button btn-confirm gl-mr-3'
= f.submit _('Save changes'), class: 'btn gl-button btn-confirm gl-mr-3'
= render 'shared/web_hooks/test_button', hook: @hook
= link_to _('Delete'), project_hook_path(@project, @hook), method: :delete, class: 'btn gl-button btn-danger float-right', data: { confirm: _('Are you sure?') }

View File

@ -15,5 +15,5 @@
= render 'shared/notes/hints'
.error-alert
.gl-mt-5.gl-display-flex
= f.submit 'Save changes', class: 'btn gl-button btn-confirm gl-mr-3'
= f.submit _('Save changes'), class: 'btn gl-button btn-confirm gl-mr-3'
= link_to "Cancel", project_tag_path(@project, @tag.name), class: "btn gl-button btn-default btn-cancel"

View File

@ -66,7 +66,7 @@
- if issuable.new_record?
= form.submit "Create #{issuable.class.model_name.human.downcase}", class: 'gl-button btn btn-confirm gl-mr-2', data: { qa_selector: 'issuable_create_button' }
- else
= form.submit 'Save changes', class: 'gl-button btn btn-confirm gl-mr-2'
= form.submit _('Save changes'), class: 'gl-button btn btn-confirm gl-mr-2'
- if issuable.new_record?
= link_to _('Cancel'), polymorphic_path([@project, issuable.class]), class: 'btn gl-button btn-default'

View File

@ -28,7 +28,7 @@
= render_suggested_colors
.form-actions
- if @label.persisted?
= f.submit 'Save changes', class: 'btn gl-button btn-confirm js-save-button'
= f.submit _('Save changes'), class: 'btn gl-button btn-confirm js-save-button'
- else
= f.submit 'Create label', class: 'btn gl-button btn-confirm js-save-button qa-label-create-button'
= link_to 'Cancel', back_path, class: 'btn gl-button btn-default btn-cancel'

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class RemoveTmpIndexApprovalProjectRulesScanners < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_NAME = 'tmp_index_approval_project_rules_scanners'
def up
remove_concurrent_index_by_name :approval_project_rules, INDEX_NAME
end
def down
add_concurrent_index :approval_project_rules, :scanners, name: INDEX_NAME, using: :gin, where: "scanners @> '{cluster_image_scanning}'"
end
end

View File

@ -0,0 +1 @@
b311fdb0a6e0e10ca3c67b9b2c3d920f8e735f0fd8398fdaa25853e14f88ae97

View File

@ -25903,8 +25903,6 @@ CREATE INDEX tmp_idx_deduplicate_vulnerability_occurrences ON vulnerability_occu
CREATE INDEX tmp_idx_on_namespaces_delayed_project_removal ON namespaces USING btree (id) WHERE (delayed_project_removal = true);
CREATE INDEX tmp_index_approval_project_rules_scanners ON approval_project_rules USING gin (scanners) WHERE (scanners @> '{cluster_image_scanning}'::text[]);
CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_child_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NOT NULL) AND (traversal_ids = '{}'::integer[]));
CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_root_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NULL) AND (traversal_ids = '{}'::integer[]));

View File

@ -90,6 +90,7 @@ callstack
callstacks
Camo
canonicalized
captcha
CentOS
Certbot
changeset

View File

@ -1,6 +1,6 @@
---
stage: Plan
group: Project Management
stage: Ecosystem
group: Integrations
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/#designated-technical-writers
---

View File

@ -1,6 +1,6 @@
---
stage: Plan
group: Project Management
stage: Ecosystem
group: Integrations
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
---

View File

@ -1,6 +1,6 @@
---
stage: Plan
group: Project Management
stage: Ecosystem
group: Integrations
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
---

View File

@ -1,6 +1,6 @@
---
stage: Plan
group: Project Management
stage: Ecosystem
group: Integrations
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
---

View File

@ -89,7 +89,7 @@ module Gitlab
end
def contributor?(user)
@project.team.contributor?(user)
@project.team.contributor?(user&.id)
end
def category(name)

View File

@ -1,26 +0,0 @@
# frozen_string_literal: true
module Gitlab
module Graphql
module TodosProjectPermissionPreloader
class FieldExtension < ::GraphQL::Schema::FieldExtension
def after_resolve(value:, memo:, **rest)
todos = value.to_a
Preloaders::UserMaxAccessLevelInProjectsPreloader.new(
todos.map(&:project).compact,
current_user(rest)
).execute
value
end
private
def current_user(options)
options.dig(:context, :current_user)
end
end
end
end
end

View File

@ -100,7 +100,7 @@ describe('init markdown', () => {
text: textArea.value,
tag: '```suggestion:-0+0\n{text}\n```',
blockTag: true,
selected: '# Does not parse the /n currently.',
selected: '# Does not parse the %br currently.',
wrap: false,
});

View File

@ -250,7 +250,7 @@ describe('Markdown field component', () => {
createSubject([{ rich_text: 'hello world\\n' }]);
expect(subject.find('[data-testid="markdownHeader"]').props('lineContent')).toBe(
'hello world/n',
'hello world%br',
);
});
});

View File

@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe Gitlab::Changelog::Config do
include ProjectForksHelper
let(:project) { build_stubbed(:project) }
describe '.from_git' do
@ -66,20 +68,33 @@ RSpec.describe Gitlab::Changelog::Config do
end
describe '#contributor?' do
it 'returns true if a user is a contributor' do
user = build_stubbed(:author)
let(:project) { create(:project, :public, :repository) }
allow(project.team).to receive(:contributor?).with(user).and_return(true)
context 'when user is a member of project' do
let(:user) { create(:user) }
expect(described_class.new(project).contributor?(user)).to eq(true)
before do
project.add_developer(user)
end
it { expect(described_class.new(project).contributor?(user)).to eq(false) }
end
it "returns true if a user isn't a contributor" do
user = build_stubbed(:author)
context 'when user has at least one merge request merged into default_branch' do
let(:contributor) { create(:user) }
let(:user_without_access) { create(:user) }
let(:user_fork) { fork_project(project, contributor, repository: true) }
allow(project.team).to receive(:contributor?).with(user).and_return(false)
before do
create(:merge_request, :merged,
author: contributor,
target_project: project,
source_project: user_fork,
target_branch: project.default_branch.to_s)
end
expect(described_class.new(project).contributor?(user)).to eq(false)
it { expect(described_class.new(project).contributor?(contributor)).to eq(true) }
it { expect(described_class.new(project).contributor?(user_without_access)).to eq(false) }
end
end

View File

@ -76,7 +76,7 @@ RSpec.describe Repositories::ChangelogService do
recorder = ActiveRecord::QueryRecorder.new { service.execute }
changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data
expect(recorder.count).to eq(11)
expect(recorder.count).to eq(9)
expect(changelog).to include('Title 1', 'Title 2')
end

View File

@ -55,8 +55,8 @@ module Tooling
def auto_generated_comment
<<-MD.strip_heredoc
---
stage: Plan
group: Project Management
stage: Ecosystem
group: Integrations
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/#designated-technical-writers
---