Commit e9903338 authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-03-26

parents e78d9834 0f85102d
...@@ -168,13 +168,17 @@ entry. ...@@ -168,13 +168,17 @@ entry.
- Add one group board to Libre. - Add one group board to Libre.
- Add support for filtering by source and target branch to merge requests API. - Add support for filtering by source and target branch to merge requests API.
### Other (14 changes, 3 of them are from the community) ### Other (18 changes, 7 of them are from the community)
- Group MRs on issue page by project and namespace. !8494 (Jeff Stubler)
- Make oauth provider login generic. !8809 (Horatiu Eugen Vlad)
- Add email button to new issue by email. !10942 (Islam Wazery)
- Update vue component naming guidelines. !17018 (George Tsiolis) - Update vue component naming guidelines. !17018 (George Tsiolis)
- Added new design for promotion modals. !17197 - Added new design for promotion modals. !17197
- Update to github-linguist 5.3.x. !17241 (Ken Ding) - Update to github-linguist 5.3.x. !17241 (Ken Ding)
- update toml-rb to 1.0.0. !17259 (Ken Ding) - update toml-rb to 1.0.0. !17259 (Ken Ding)
- Keep track of projects a user interacted with. !17327 - Keep track of projects a user interacted with. !17327
- Moved o_auth/saml/ldap modules under gitlab/auth. !17359 (Horatiu Eugen Vlad)
- Enables eslint in codeclimate job. !17392 - Enables eslint in codeclimate job. !17392
- Port Labels Select dropdown to Vue. !17411 - Port Labels Select dropdown to Vue. !17411
- Add NOT NULL constraint to projects.namespace_id. !17448 - Add NOT NULL constraint to projects.namespace_id. !17448
......
...@@ -383,7 +383,7 @@ GEM ...@@ -383,7 +383,7 @@ GEM
signet (~> 0.7) signet (~> 0.7)
gpgme (2.0.13) gpgme (2.0.13)
mini_portile2 (~> 2.1) mini_portile2 (~> 2.1)
grape (1.0.0) grape (1.0.2)
activesupport activesupport
builder builder
mustermann-grape (~> 1.0.0) mustermann-grape (~> 1.0.0)
...@@ -536,7 +536,7 @@ GEM ...@@ -536,7 +536,7 @@ GEM
multi_json (1.13.1) multi_json (1.13.1)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.0.0) multipart-post (2.0.0)
mustermann (1.0.0) mustermann (1.0.2)
mustermann-grape (1.0.0) mustermann-grape (1.0.0)
mustermann (~> 1.0.0) mustermann (~> 1.0.0)
mysql2 (0.4.10) mysql2 (0.4.10)
......
---
title: Fix forking to subgroup via API when namespace is given by name
merge_request: 17815
author: Jan Beckmann
type: fixed
...@@ -234,11 +234,7 @@ module API ...@@ -234,11 +234,7 @@ module API
namespace_id = fork_params[:namespace] namespace_id = fork_params[:namespace]
if namespace_id.present? if namespace_id.present?
fork_params[:namespace] = if namespace_id =~ /^\d+$/ fork_params[:namespace] = find_namespace(namespace_id)
Namespace.find_by(id: namespace_id)
else
Namespace.find_by_path_or_name(namespace_id)
end
unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace]) unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace])
not_found!('Target Namespace') not_found!('Target Namespace')
......
...@@ -62,12 +62,7 @@ module API ...@@ -62,12 +62,7 @@ module API
conflict!("Protected branch '#{params[:name]}' already exists") conflict!("Protected branch '#{params[:name]}' already exists")
end end
# Replace with `declared(params)` after updating to grape v1.0.2 api_service = ::ProtectedBranches::ApiService.new(user_project, current_user, declared(params))
# See https://github.com/ruby-grape/grape/pull/1710
# and https://gitlab.com/gitlab-org/gitlab-ce/issues/40843
declared_params = params.slice("name", "push_access_level", "merge_access_level", "allowed_to_push", "allowed_to_merge")
api_service = ::ProtectedBranches::ApiService.new(user_project, current_user, declared_params)
protected_branch = api_service.create protected_branch = api_service.create
if protected_branch.persisted? if protected_branch.persisted?
......
...@@ -272,11 +272,7 @@ module API ...@@ -272,11 +272,7 @@ module API
namespace_id = fork_params[:namespace] namespace_id = fork_params[:namespace]
if namespace_id.present? if namespace_id.present?
fork_params[:namespace] = if namespace_id =~ /^\d+$/ fork_params[:namespace] = find_namespace(namespace_id)
Namespace.find_by(id: namespace_id)
else
Namespace.find_by_path_or_name(namespace_id)
end
unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace]) unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace])
not_found!('Target Namespace') not_found!('Target Namespace')
......
const glob = require('glob'); const glob = require('glob');
const prettier = require('prettier'); const prettier = require('prettier');
const fs = require('fs'); const fs = require('fs');
const path = require('path');
const prettierIgnore = require('ignore')();
const getStagedFiles = require('./frontend_script_utils').getStagedFiles; const getStagedFiles = require('./frontend_script_utils').getStagedFiles;
...@@ -10,6 +12,10 @@ const allFiles = mode === 'check-all' || mode === 'save-all'; ...@@ -10,6 +12,10 @@ const allFiles = mode === 'check-all' || mode === 'save-all';
const config = { const config = {
patterns: ['**/*.js', '**/*.vue', '**/*.scss'], patterns: ['**/*.js', '**/*.vue', '**/*.scss'],
/*
* The ignore patterns below are just to reduce search time with glob, as it includes the
* folders with the most ignored assets, the actual `.prettierignore` will be used later on
*/
ignore: ['**/node_modules/**', '**/vendor/**', '**/public/**'], ignore: ['**/node_modules/**', '**/vendor/**', '**/public/**'],
parsers: { parsers: {
js: 'babylon', js: 'babylon',
...@@ -17,6 +23,20 @@ const config = { ...@@ -17,6 +23,20 @@ const config = {
scss: 'css', scss: 'css',
}, },
}; };
/*
* Unfortunately the prettier API does not expose support for `.prettierignore` files, they however
* use the ignore package, so we do the same. We simply cannot use the glob package, because
* gitignore style is not compatible with globs ignore style.
*/
prettierIgnore.add(
fs
.readFileSync(path.join(__dirname, '../../', '.prettierignore'))
.toString()
.trim()
.split(/\r?\n/)
);
const availableExtensions = Object.keys(config.parsers); const availableExtensions = Object.keys(config.parsers);
console.log(`Loading ${allFiles ? 'All' : 'Staged'} Files ...`); console.log(`Loading ${allFiles ? 'All' : 'Staged'} Files ...`);
...@@ -44,6 +64,8 @@ if (allFiles) { ...@@ -44,6 +64,8 @@ if (allFiles) {
files = stagedFiles.filter(f => availableExtensions.includes(f.split('.').pop())); files = stagedFiles.filter(f => availableExtensions.includes(f.split('.').pop()));
} }
files = prettierIgnore.filter(files);
if (!files.length) { if (!files.length) {
console.log('No Files found to process with Prettier'); console.log('No Files found to process with Prettier');
return; return;
......
...@@ -1784,6 +1784,12 @@ describe API::Projects do ...@@ -1784,6 +1784,12 @@ describe API::Projects do
group group
end end
let(:group3) do
group = create(:group, name: 'group3_name', parent: group2)
group.add_owner(user2)
group
end
before do before do
project.add_reporter(user2) project.add_reporter(user2)
end end
...@@ -1879,6 +1885,15 @@ describe API::Projects do ...@@ -1879,6 +1885,15 @@ describe API::Projects do
expect(json_response['namespace']['name']).to eq(group2.name) expect(json_response['namespace']['name']).to eq(group2.name)
end end
it 'forks to owned subgroup' do
full_path = "#{group2.path}/#{group3.path}"
post api("/projects/#{project.id}/fork", user2), namespace: full_path
expect(response).to have_gitlab_http_status(201)
expect(json_response['namespace']['name']).to eq(group3.name)
expect(json_response['namespace']['full_path']).to eq(full_path)
end
it 'fails to fork to not owned group' do it 'fails to fork to not owned group' do
post api("/projects/#{project.id}/fork", user2), namespace: group.name post api("/projects/#{project.id}/fork", user2), namespace: group.name
......
...@@ -4232,7 +4232,7 @@ ignore@^3.2.0: ...@@ -4232,7 +4232,7 @@ ignore@^3.2.0:
version "3.3.3" version "3.3.3"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d"
ignore@^3.3.5: ignore@^3.3.5, ignore@^3.3.7:
version "3.3.7" version "3.3.7"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021"
......
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