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 { ...@@ -95,16 +95,18 @@ export default {
return this.file.changed || this.file.tempFile || this.file.staged; 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() { mounted() {
if (this.hasPathAtCurrentRoute()) { if (this.hasPathAtCurrentRoute()) {
this.scrollIntoView(true); this.scrollIntoView(true);
} }
}, },
updated() {
if (this.file.type === 'blob' && this.file.active) {
this.scrollIntoView();
}
},
methods: { methods: {
...mapActions(['toggleTreeOpen']), ...mapActions(['toggleTreeOpen']),
clickFile() { clickFile() {
......
...@@ -327,7 +327,7 @@ h6 { ...@@ -327,7 +327,7 @@ h6 {
pre { pre {
font-family: $monospace-font; font-family: $monospace-font;
display: block; display: block;
padding: $gl-padding-8; padding: $gl-padding-8 $input-horizontal-padding;
margin: 0 0 $gl-padding-8; margin: 0 0 $gl-padding-8;
font-size: 13px; font-size: 13px;
word-break: break-all; word-break: break-all;
......
...@@ -237,6 +237,7 @@ $gl-vert-padding: 6px; ...@@ -237,6 +237,7 @@ $gl-vert-padding: 6px;
$gl-padding-top: 10px; $gl-padding-top: 10px;
$gl-sidebar-padding: 22px; $gl-sidebar-padding: 22px;
$gl-bar-padding: 3px; $gl-bar-padding: 3px;
$input-horizontal-padding: 12px;
/* /*
* Misc * Misc
......
...@@ -1145,7 +1145,7 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding; ...@@ -1145,7 +1145,7 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding;
} }
.avatar-container { .avatar-container {
flex: initial; flex: 0 0 auto;
margin-right: 0; margin-right: 0;
} }
......
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
color: $gl-text-color; color: $gl-text-color;
border-radius: 0 0 3px 3px; border-radius: 0 0 3px 3px;
.code {
padding: 0;
}
.unfold { .unfold {
cursor: pointer; cursor: pointer;
} }
......
...@@ -64,8 +64,7 @@ module SubmoduleHelper ...@@ -64,8 +64,7 @@ module SubmoduleHelper
end end
def relative_self_url?(url) def relative_self_url?(url)
# (./)?(../repo.git) || (./)?(../../project/repo.git) ) url.start_with?('../', './')
url =~ %r{\A((\./)?(\.\./))(?!(\.\.)|(.*/)).*(\.git)?\z} || url =~ %r{\A((\./)?(\.\./){2})(?!(\.\.))([^/]*)/(?!(\.\.)|(.*/)).*(\.git)?\z}
end end
def standard_links(host, namespace, project, commit) def standard_links(host, namespace, project, commit)
...@@ -73,25 +72,29 @@ module SubmoduleHelper ...@@ -73,25 +72,29 @@ module SubmoduleHelper
[base, [base, '/tree/', commit].join('')] [base, [base, '/tree/', commit].join('')]
end end
def relative_self_links(url, commit, project) def relative_self_links(relative_path, commit, project)
url.rstrip! relative_path.rstrip!
# Map relative links to a namespace and project absolute_project_path = "/" + project.full_path
# 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(/^\.\.$/, '')
if namespace.empty? # Resolve `relative_path` to target path
namespace = project.namespace.full_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 end
target_namespace_path.sub!(%r{^/}, '')
submodule_base = File.basename(submodule_project_path, '.git')
begin begin
[ [
namespace_project_path(namespace, base), namespace_project_path(target_namespace_path, submodule_base),
namespace_project_tree_path(namespace, base, commit) namespace_project_tree_path(target_namespace_path, submodule_base, commit)
] ]
rescue ActionController::UrlGenerationError rescue ActionController::UrlGenerationError
[nil, nil] [nil, nil]
......
...@@ -6,6 +6,7 @@ module TriggerableHooks ...@@ -6,6 +6,7 @@ module TriggerableHooks
push_hooks: :push_events, push_hooks: :push_events,
tag_push_hooks: :tag_push_events, tag_push_hooks: :tag_push_events,
issue_hooks: :issues_events, issue_hooks: :issues_events,
confidential_note_hooks: :confidential_note_events,
confidential_issue_hooks: :confidential_issues_events, confidential_issue_hooks: :confidential_issues_events,
note_hooks: :note_events, note_hooks: :note_events,
merge_request_hooks: :merge_requests_events, merge_request_hooks: :merge_requests_events,
......
...@@ -10,17 +10,7 @@ class BackgroundMigrationWorker ...@@ -10,17 +10,7 @@ class BackgroundMigrationWorker
# maintenance related tasks have plenty of time to clean up after a migration # maintenance related tasks have plenty of time to clean up after a migration
# has been performed. # has been performed.
def self.minimum_interval def self.minimum_interval
if enable_health_check?
2.minutes.to_i 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 end
# Performs the background migration. # Performs the background migration.
...@@ -86,8 +76,6 @@ class BackgroundMigrationWorker ...@@ -86,8 +76,6 @@ class BackgroundMigrationWorker
# class_name - The name of the background migration that we might want to # class_name - The name of the background migration that we might want to
# run. # run.
def healthy_database? def healthy_database?
return true unless self.class.enable_health_check?
return true unless Gitlab::Database.postgresql? return true unless Gitlab::Database.postgresql?
!Postgresql::ReplicationSlot.lag_too_great? !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 ...@@ -237,6 +237,8 @@ module Gitlab
end end
elsif user elsif user
# User access is verified in check_change_access! # User access is verified in check_change_access!
elsif authed_via_jwt?
# Authenticated via JWT
else else
raise UnauthorizedError, ERROR_MESSAGES[:upload] raise UnauthorizedError, ERROR_MESSAGES[:upload]
end end
...@@ -344,6 +346,10 @@ module Gitlab ...@@ -344,6 +346,10 @@ module Gitlab
!Gitlab.config.gitlab_shell.receive_pack !Gitlab.config.gitlab_shell.receive_pack
end end
def authed_via_jwt?
false
end
protected protected
def check_size_limit? def check_size_limit?
......
...@@ -94,7 +94,10 @@ module Gitlab ...@@ -94,7 +94,10 @@ module Gitlab
end end
def restore_project def restore_project
@project.update_columns(project_params) Gitlab::Timeless.timeless(@project) do
@project.update(project_params)
end
@project @project
end end
......
require 'pathname'
module QA module QA
module Page module Page
class View class View
...@@ -9,7 +11,7 @@ module QA ...@@ -9,7 +11,7 @@ module QA
end end
def pathname def pathname
@pathname ||= Pathname.new(::File.join(__dir__, '../../../', @path)) @pathname ||= ::Pathname.new(::File.join(__dir__, '../../../', @path))
.cleanpath.expand_path .cleanpath.expand_path
end end
......
...@@ -30,6 +30,7 @@ describe Projects::HooksController do ...@@ -30,6 +30,7 @@ describe Projects::HooksController do
tag_push_events: true, tag_push_events: true,
merge_requests_events: true, merge_requests_events: true,
issues_events: true, issues_events: true,
confidential_note_events: true,
confidential_issues_events: true, confidential_issues_events: true,
note_events: true, note_events: true,
job_events: true, job_events: true,
......
...@@ -162,42 +162,77 @@ describe SubmoduleHelper do ...@@ -162,42 +162,77 @@ describe SubmoduleHelper do
end end
context 'submodules with relative links' do 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(: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 expect(result).to eq([expected_path, "#{expected_path}/tree/#{submodule_item.id}"])
result = relative_self_links('../test.git', commit_id, project)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end end
it 'with trailing whitespace' do it 'handles project under same group' do
result = relative_self_links('../test.git ', commit_id, project) expect_relative_link_to_resolve_to('../test.git', "/#{group.path}/test")
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end end
it 'two levels down' do it 'handles trailing whitespace' do
result = relative_self_links('../../test.git', commit_id, project) expect_relative_link_to_resolve_to('../test.git ', "/#{group.path}/test")
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end end
it 'one level down with namespace and repo' do it 'handles project under another top group' do
result = relative_self_links('../foobar/test.git', commit_id, project) expect_relative_link_to_resolve_to('../../baz/test.git ', "/baz/test")
expect(result).to eq(["/foobar/test", "/foobar/test/tree/#{commit_id}"])
end end
it 'two levels down with namespace and repo' do context 'repo path resolves to be located at root (namespace absent)' do
result = relative_self_links('../foobar/baz/test.git', commit_id, project) it 'returns nil' do
expect(result).to eq(["/baz/test", "/baz/test/tree/#{commit_id}"]) 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 end
context 'personal project' do context 'personal project' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
it 'one level down with personal project' do it 'handles referencing another personal project' do
result = relative_self_links('../test.git', commit_id, project) expect_relative_link_to_resolve_to('../test.git', "/#{user.username}/test")
expect(result).to eq(["/#{user.username}/test", "/#{user.username}/test/tree/#{commit_id}"])
end end
end end
end end
......
...@@ -121,4 +121,25 @@ describe('RepoFile', () => { ...@@ -121,4 +121,25 @@ describe('RepoFile', () => {
).toContain('Locked by testuser'); ).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 ...@@ -63,6 +63,16 @@ describe Gitlab::ImportExport::Importer do
importer.execute importer.execute
end 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 end
context 'when project successfully restored' do context 'when project successfully restored' do
......
...@@ -44,6 +44,7 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } ...@@ -44,6 +44,7 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config| RSpec.configure do |config|
config.use_transactional_fixtures = false config.use_transactional_fixtures = false
config.use_instantiated_fixtures = false config.use_instantiated_fixtures = false
config.fixture_path = Rails.root
config.verbose_retry = true config.verbose_retry = true
config.display_try_failure_messages = true config.display_try_failure_messages = true
......
...@@ -11,6 +11,4 @@ RSpec.configure do |config| ...@@ -11,6 +11,4 @@ RSpec.configure do |config|
config.include StubMetrics config.include StubMetrics
config.include StubObjectStorage config.include StubObjectStorage
config.include StubENV config.include StubENV
config.fixture_path = Rails.root if defined?(Rails)
end 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