Commit 4a52c1f4 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ce-to-ee-2018-09-01' into 'master'

CE upstream - 2018-09-01 00:21 UTC

See merge request gitlab-org/gitlab-ee!7154
parents 4584d760 5d90377c
......@@ -95,16 +95,18 @@ export default {
return this.file.changed || this.file.tempFile || this.file.staged;
},
},
watch: {
'file.active': function fileActiveWatch(active) {
if (this.file.type === 'blob' && active) {
this.scrollIntoView();
}
},
},
mounted() {
if (this.hasPathAtCurrentRoute()) {
this.scrollIntoView(true);
}
},
updated() {
if (this.file.type === 'blob' && this.file.active) {
this.scrollIntoView();
}
},
methods: {
...mapActions(['toggleTreeOpen']),
clickFile() {
......
......@@ -327,7 +327,7 @@ h6 {
pre {
font-family: $monospace-font;
display: block;
padding: $gl-padding-8;
padding: $gl-padding-8 $input-horizontal-padding;
margin: 0 0 $gl-padding-8;
font-size: 13px;
word-break: break-all;
......
......@@ -237,6 +237,7 @@ $gl-vert-padding: 6px;
$gl-padding-top: 10px;
$gl-sidebar-padding: 22px;
$gl-bar-padding: 3px;
$input-horizontal-padding: 12px;
/*
* Misc
......
......@@ -1145,7 +1145,7 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding;
}
.avatar-container {
flex: initial;
flex: 0 0 auto;
margin-right: 0;
}
......
......@@ -25,10 +25,6 @@
color: $gl-text-color;
border-radius: 0 0 3px 3px;
.code {
padding: 0;
}
.unfold {
cursor: pointer;
}
......
......@@ -64,8 +64,7 @@ module SubmoduleHelper
end
def relative_self_url?(url)
# (./)?(../repo.git) || (./)?(../../project/repo.git) )
url =~ %r{\A((\./)?(\.\./))(?!(\.\.)|(.*/)).*(\.git)?\z} || url =~ %r{\A((\./)?(\.\./){2})(?!(\.\.))([^/]*)/(?!(\.\.)|(.*/)).*(\.git)?\z}
url.start_with?('../', './')
end
def standard_links(host, namespace, project, commit)
......@@ -73,25 +72,29 @@ module SubmoduleHelper
[base, [base, '/tree/', commit].join('')]
end
def relative_self_links(url, commit, project)
url.rstrip!
# Map relative links to a namespace and project
# For example:
# ../bar.git -> same namespace, repo bar
# ../foo/bar.git -> namespace foo, repo bar
# ../../foo/bar/baz.git -> namespace bar, repo baz
components = url.split('/')
base = components.pop.gsub(/.git$/, '')
namespace = components.pop.gsub(/^\.\.$/, '')
def relative_self_links(relative_path, commit, project)
relative_path.rstrip!
absolute_project_path = "/" + project.full_path
if namespace.empty?
namespace = project.namespace.full_path
# Resolve `relative_path` to target path
# Assuming `absolute_project_path` is `/g1/p1`:
# ../p2.git -> /g1/p2
# ../g2/p3.git -> /g1/g2/p3
# ../../g3/g4/p4.git -> /g3/g4/p4
submodule_project_path = File.absolute_path(relative_path, absolute_project_path)
target_namespace_path = File.dirname(submodule_project_path)
if target_namespace_path == '/' || target_namespace_path.start_with?(absolute_project_path)
return [nil, nil]
end
target_namespace_path.sub!(%r{^/}, '')
submodule_base = File.basename(submodule_project_path, '.git')
begin
[
namespace_project_path(namespace, base),
namespace_project_tree_path(namespace, base, commit)
namespace_project_path(target_namespace_path, submodule_base),
namespace_project_tree_path(target_namespace_path, submodule_base, commit)
]
rescue ActionController::UrlGenerationError
[nil, nil]
......
......@@ -6,6 +6,7 @@ module TriggerableHooks
push_hooks: :push_events,
tag_push_hooks: :tag_push_events,
issue_hooks: :issues_events,
confidential_note_hooks: :confidential_note_events,
confidential_issue_hooks: :confidential_issues_events,
note_hooks: :note_events,
merge_request_hooks: :merge_requests_events,
......
......@@ -10,17 +10,7 @@ class BackgroundMigrationWorker
# maintenance related tasks have plenty of time to clean up after a migration
# has been performed.
def self.minimum_interval
if enable_health_check?
2.minutes.to_i
else
5.minutes.to_i
end
end
def self.enable_health_check?
Rails.env.development? ||
Rails.env.test? ||
Feature.enabled?('background_migration_health_check')
end
# Performs the background migration.
......@@ -86,8 +76,6 @@ class BackgroundMigrationWorker
# class_name - The name of the background migration that we might want to
# run.
def healthy_database?
return true unless self.class.enable_health_check?
return true unless Gitlab::Database.postgresql?
!Postgresql::ReplicationSlot.lag_too_great?
......
---
title: Fix git submodule link for subgroup projects with relative path
merge_request: 21154
author:
type: fixed
---
title: Importing a project no longer fails when visibility level holds a string value
type
merge_request: 21242
author:
type: fixed
---
title: Fixed IDE file row scrolling into view when hovering
merge_request:
author:
type: fixed
---
title: Remove health check feature flag in BackgroundMigrationWorker
merge_request:
author:
type: changed
---
title: Fix "Confidential comments" button not saving in project hooks
merge_request: 21289
author:
type: fixed
---
title: Increase padding in code blocks
merge_request:
author:
type: fixed
......@@ -237,6 +237,8 @@ module Gitlab
end
elsif user
# User access is verified in check_change_access!
elsif authed_via_jwt?
# Authenticated via JWT
else
raise UnauthorizedError, ERROR_MESSAGES[:upload]
end
......@@ -344,6 +346,10 @@ module Gitlab
!Gitlab.config.gitlab_shell.receive_pack
end
def authed_via_jwt?
false
end
protected
def check_size_limit?
......
......@@ -94,7 +94,10 @@ module Gitlab
end
def restore_project
@project.update_columns(project_params)
Gitlab::Timeless.timeless(@project) do
@project.update(project_params)
end
@project
end
......
require 'pathname'
module QA
module Page
class View
......@@ -9,7 +11,7 @@ module QA
end
def pathname
@pathname ||= Pathname.new(::File.join(__dir__, '../../../', @path))
@pathname ||= ::Pathname.new(::File.join(__dir__, '../../../', @path))
.cleanpath.expand_path
end
......
......@@ -30,6 +30,7 @@ describe Projects::HooksController do
tag_push_events: true,
merge_requests_events: true,
issues_events: true,
confidential_note_events: true,
confidential_issues_events: true,
note_events: true,
job_events: true,
......
......@@ -162,42 +162,77 @@ describe SubmoduleHelper do
end
context 'submodules with relative links' do
let(:group) { create(:group, name: "Master Project", path: "master-project") }
let(:group) { create(:group, name: "top group", path: "top-group") }
let(:project) { create(:project, group: group) }
let(:commit_id) { sample_commit[:id] }
let(:repo) { double(:repo, project: project) }
def expect_relative_link_to_resolve_to(relative_path, expected_path)
allow(repo).to receive(:submodule_url_for).and_return(relative_path)
result = submodule_links(submodule_item)
it 'one level down' do
result = relative_self_links('../test.git', commit_id, project)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
expect(result).to eq([expected_path, "#{expected_path}/tree/#{submodule_item.id}"])
end
it 'with trailing whitespace' do
result = relative_self_links('../test.git ', commit_id, project)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
it 'handles project under same group' do
expect_relative_link_to_resolve_to('../test.git', "/#{group.path}/test")
end
it 'two levels down' do
result = relative_self_links('../../test.git', commit_id, project)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
it 'handles trailing whitespace' do
expect_relative_link_to_resolve_to('../test.git ', "/#{group.path}/test")
end
it 'one level down with namespace and repo' do
result = relative_self_links('../foobar/test.git', commit_id, project)
expect(result).to eq(["/foobar/test", "/foobar/test/tree/#{commit_id}"])
it 'handles project under another top group' do
expect_relative_link_to_resolve_to('../../baz/test.git ', "/baz/test")
end
it 'two levels down with namespace and repo' do
result = relative_self_links('../foobar/baz/test.git', commit_id, project)
expect(result).to eq(["/baz/test", "/baz/test/tree/#{commit_id}"])
context 'repo path resolves to be located at root (namespace absent)' do
it 'returns nil' do
allow(repo).to receive(:submodule_url_for).and_return('../../test.git')
result = submodule_links(submodule_item)
expect(result).to eq([nil, nil])
end
end
context 'repo path resolves to be located underneath current project path' do
it 'returns nil because it is not possible to have repo nested under another repo' do
allow(repo).to receive(:submodule_url_for).and_return('./test.git')
result = submodule_links(submodule_item)
expect(result).to eq([nil, nil])
end
end
context 'subgroup' do
let(:sub_group) { create(:group, parent: group, name: "sub group", path: "sub-group") }
let(:sub_project) { create(:project, group: sub_group) }
context 'project in sub group' do
let(:project) { sub_project }
it "handles referencing ancestor group's project" do
expect_relative_link_to_resolve_to('../../../top-group/test.git', "/#{group.path}/test")
end
end
it "handles referencing descendent group's project" do
expect_relative_link_to_resolve_to('../sub-group/test.git', "/top-group/sub-group/test")
end
it "handles referencing another top group's project" do
expect_relative_link_to_resolve_to('../../frontend/css/test.git', "/frontend/css/test")
end
end
context 'personal project' do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
it 'one level down with personal project' do
result = relative_self_links('../test.git', commit_id, project)
expect(result).to eq(["/#{user.username}/test", "/#{user.username}/test/tree/#{commit_id}"])
it 'handles referencing another personal project' do
expect_relative_link_to_resolve_to('../test.git', "/#{user.username}/test")
end
end
end
......
......@@ -121,4 +121,25 @@ describe('RepoFile', () => {
).toContain('Locked by testuser');
});
});
it('calls scrollIntoView if made active', done => {
createComponent({
file: {
...file(),
type: 'blob',
active: false,
},
level: 0,
});
spyOn(vm, 'scrollIntoView');
vm.file.active = true;
vm.$nextTick(() => {
expect(vm.scrollIntoView).toHaveBeenCalled();
done();
});
});
});
......@@ -63,6 +63,16 @@ describe Gitlab::ImportExport::Importer do
importer.execute
end
it 'sets the correct visibility_level when visibility level is a string' do
project.create_or_update_import_data(
data: { override_params: { visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s } }
)
importer.execute
expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE)
end
end
context 'when project successfully restored' do
......
......@@ -44,6 +44,7 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.use_instantiated_fixtures = false
config.fixture_path = Rails.root
config.verbose_retry = true
config.display_try_failure_messages = true
......
......@@ -11,6 +11,4 @@ RSpec.configure do |config|
config.include StubMetrics
config.include StubObjectStorage
config.include StubENV
config.fixture_path = Rails.root if defined?(Rails)
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment