Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-06-09 06:09:18 +00:00
parent 5f003678af
commit 3607cd931c
9 changed files with 53 additions and 23 deletions

View File

@ -9,7 +9,6 @@ const componentsByReferenceType = {
merge_request: MRPopover,
};
let renderedPopover;
let renderFn;
const handleIssuablePopoverMouseOut = ({ target }) => {
@ -18,12 +17,10 @@ const handleIssuablePopoverMouseOut = ({ target }) => {
if (renderFn) {
clearTimeout(renderFn);
}
if (renderedPopover) {
renderedPopover.$destroy();
renderedPopover = null;
}
};
const popoverMountedAttr = 'data-popover-mounted';
/**
* Adds a MergeRequestPopover component to the body, hands over as much data as the target element has in data attributes.
* loads based on data-project-path and data-iid more data about an MR from the API and sets it on the popover
@ -34,13 +31,14 @@ const handleIssuablePopoverMount = ({
title,
iid,
referenceType,
}) => ({ target }) => {
target,
}) => {
// Add listener to actually remove it again
target.addEventListener('mouseleave', handleIssuablePopoverMouseOut);
renderFn = setTimeout(() => {
const PopoverComponent = Vue.extend(componentsByReferenceType[referenceType]);
renderedPopover = new PopoverComponent({
new PopoverComponent({
propsData: {
target,
projectPath,
@ -48,9 +46,9 @@ const handleIssuablePopoverMount = ({
cachedTitle: title,
},
apolloProvider,
});
}).$mount();
renderedPopover.$mount();
target.setAttribute(popoverMountedAttr, true);
}, 200); // 200ms delay so not every mouseover triggers Popover + API Call
};
@ -68,10 +66,18 @@ export default (elements) => {
const title = el.dataset.mrTitle || el.title;
if (!el.getAttribute(listenerAddedAttr) && projectPath && title && iid && referenceType) {
el.addEventListener(
'mouseenter',
handleIssuablePopoverMount({ apolloProvider, projectPath, title, iid, referenceType }),
);
el.addEventListener('mouseenter', ({ target }) => {
if (!el.getAttribute(popoverMountedAttr)) {
handleIssuablePopoverMount({
apolloProvider,
projectPath,
title,
iid,
referenceType,
target,
});
}
});
el.setAttribute(listenerAddedAttr, true);
}
});

View File

@ -6,7 +6,7 @@
.input-group-prepend.has-tooltip{ title: root_url }
.input-group-text
= root_url
= select_tag :group_id, namespaces_options(nil, display_path: true, groups_only: true), { class: 'select2 js-select-namespace' }
= select_tag :group_id, namespaces_options(params[:namespace_id], display_path: true, groups_only: true), { class: 'select2 js-select-namespace' }
.form-text.text-muted
= _('Choose the top-level group for your repository imports.')

View File

@ -67,7 +67,7 @@
- if manifest_import_enabled?
%div
= link_to new_import_manifest_path, class: 'gl-button btn-default btn import_manifest js-import-project-btn', data: { platform: 'manifest_file', **tracking_attrs_data(track_label, 'click_button', 'manifest_file') } do
= link_to new_import_manifest_path(namespace_id: namespace_id), class: 'gl-button btn-default btn import_manifest js-import-project-btn', data: { platform: 'manifest_file', **tracking_attrs_data(track_label, 'click_button', 'manifest_file') } do
.gl-button-icon
= sprite_icon('doc-text')
Manifest file

View File

@ -47,7 +47,7 @@ Use the built-in continuous integration in GitLab.
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.

View File

@ -54,7 +54,8 @@ module Gitlab
end
def match_content_type?(env)
env['CONTENT_TYPE'] == 'application/json' ||
env['CONTENT_TYPE'].nil? ||
env['CONTENT_TYPE'] == 'application/json' ||
env['CONTENT_TYPE'] == 'application/x-sentry-envelope'
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Plan', :requires_admin, :orchestrated, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/293699', type: :bug } do
RSpec.describe 'Plan', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/293699', type: :bug } do
describe 'Assignees' do
let(:user1) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:user2) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }

View File

@ -8,11 +8,12 @@ RSpec.describe Gitlab::Middleware::CompressedJson do
let(:app) { double(:app) }
let(:middleware) { described_class.new(app) }
let(:content_type) { 'application/json' }
let(:env) do
{
'HTTP_CONTENT_ENCODING' => 'gzip',
'REQUEST_METHOD' => 'POST',
'CONTENT_TYPE' => 'application/json',
'CONTENT_TYPE' => content_type,
'PATH_INFO' => path,
'rack.input' => StringIO.new(input)
}
@ -35,6 +36,12 @@ RSpec.describe Gitlab::Middleware::CompressedJson do
let(:path) { '/api/v4/error_tracking/collector/1/store'}
it_behaves_like 'decompress middleware'
context 'with no Content-Type' do
let(:content_type) { nil }
it_behaves_like 'decompress middleware'
end
end
context 'with collector route under relative url' do

View File

@ -106,17 +106,30 @@ RSpec.describe API::ErrorTracking::Collector do
end
context 'gzip body' do
let(:headers) do
let(:standard_headers) do
{
'X-Sentry-Auth' => "Sentry sentry_key=#{client_key.public_key}",
'HTTP_CONTENT_ENCODING' => 'gzip',
'CONTENT_TYPE' => 'application/x-sentry-envelope'
'HTTP_CONTENT_ENCODING' => 'gzip'
}
end
let(:params) { ActiveSupport::Gzip.compress(raw_event) }
it_behaves_like 'successful request'
context 'with application/x-sentry-envelope Content-Type' do
let(:headers) { standard_headers.merge({ 'CONTENT_TYPE' => 'application/x-sentry-envelope' }) }
it_behaves_like 'successful request'
end
context 'with unexpected Content-Type' do
let(:headers) { standard_headers.merge({ 'CONTENT_TYPE' => 'application/gzip' }) }
it 'responds with 415' do
subject
expect(response).to have_gitlab_http_status(:unsupported_media_type)
end
end
end
end

View File

@ -151,6 +151,9 @@ module GitalySetup
toml ||= config_path(service)
args = service_cmd(service, toml)
# Ensure that tmp/run exists
FileUtils.mkdir_p(runtime_dir)
# Ensure user configuration does not affect Git
# Context: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58776#note_547613780
env = self.env.merge('HOME' => nil, 'XDG_CONFIG_HOME' => nil)