summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md15
-rw-r--r--app/models/project_group_link.rb11
-rw-r--r--app/views/projects/tags/index.html.haml2
-rw-r--r--changelogs/unreleased/27267-events-project-query-performance-regression.yml4
-rw-r--r--changelogs/unreleased/27989-disable-counting-tags.yml4
-rw-r--r--changelogs/unreleased/28093-snippet-and-issue-spam-check-on-edit.yml4
-rw-r--r--changelogs/unreleased/28212-avoid-dos-on-build-trace.yml4
-rw-r--r--changelogs/unreleased/28357-colon-search.yml4
-rw-r--r--changelogs/unreleased/6073_project_api.yml4
-rw-r--r--changelogs/unreleased/add-issues-tooltip.yml4
-rw-r--r--changelogs/unreleased/commit-search-ui-fix.yml4
-rw-r--r--changelogs/unreleased/issue-tags-layout.yml4
-rw-r--r--changelogs/unreleased/issue_25112.yml4
-rw-r--r--changelogs/unreleased/issue_28051_2.yml4
-rw-r--r--changelogs/unreleased/pages-0-3-2.yml4
-rw-r--r--changelogs/unreleased/zj-fix-slash-command-labels.yml4
-rw-r--r--doc/api/projects.md4
-rw-r--r--lib/api/projects.rb3
-rw-r--r--lib/api/v3/projects.rb3
-rw-r--r--spec/models/project_group_link_spec.rb17
-rw-r--r--spec/requests/api/projects_spec.rb33
-rw-r--r--spec/requests/api/v3/projects_spec.rb33
22 files changed, 115 insertions, 58 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c039335c46d..f279a57105c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,21 @@
documentation](doc/development/changelog.md) for instructions on adding your own
entry.
+## 8.17.1 (2017-02-28)
+
+- Replace setInterval with setTimeout to prevent highly frequent requests. !9271 (Takuya Noguchi)
+- Disable unused tags count cache for Projects, Builds and Runners.
+- Spam check and reCAPTCHA improvements.
+- Allow searching issues for strings containing colons.
+- Disabled tooltip on add issues button in usse boards.
+- Fixed commit search UI.
+- Fix MR changes tab size count when there are over 100 files in the diff.
+- Disable invalid service templates.
+- Use default branch as target_branch when parameter is missing.
+- Upgrade GitLab Pages to v0.3.2.
+- Add performance query regression fix for !9088 affecting #27267.
+- Chat slash commands show labels correctly.
+
## 8.17.0 (2017-02-22)
- API: Fix file downloading. !0 (8267)
diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb
index 5cb6b0c527d..ac1e9ab2b0b 100644
--- a/app/models/project_group_link.rb
+++ b/app/models/project_group_link.rb
@@ -33,8 +33,15 @@ class ProjectGroupLink < ActiveRecord::Base
private
def different_group
- if self.group && self.project && self.project.group == self.group
- errors.add(:base, "Project cannot be shared with the project it is in.")
+ return unless self.group && self.project
+
+ project_group = self.project.group
+ return unless project_group
+
+ group_ids = project_group.ancestors.map(&:id).push(project_group.id)
+
+ if group_ids.include?(self.group.id)
+ errors.add(:base, "Project cannot be shared with the group it is in or one of its ancestors.")
end
end
diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml
index e2f132f7742..7f9a44e565f 100644
--- a/app/views/projects/tags/index.html.haml
+++ b/app/views/projects/tags/index.html.haml
@@ -3,7 +3,7 @@
= render "projects/commits/head"
.flex-list{ class: container_class }
- .top-area.flex-row
+ .top-area.adjust
.nav-text.row-main-content
Tags give the ability to mark specific points in history as being important
diff --git a/changelogs/unreleased/27267-events-project-query-performance-regression.yml b/changelogs/unreleased/27267-events-project-query-performance-regression.yml
deleted file mode 100644
index a1697b57eac..00000000000
--- a/changelogs/unreleased/27267-events-project-query-performance-regression.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: 'Add performance query regression fix for !9088 affecting #27267'
-merge_request:
-author:
diff --git a/changelogs/unreleased/27989-disable-counting-tags.yml b/changelogs/unreleased/27989-disable-counting-tags.yml
deleted file mode 100644
index 988785ac454..00000000000
--- a/changelogs/unreleased/27989-disable-counting-tags.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Disable unused tags count cache for Projects, Builds and Runners
-merge_request:
-author:
diff --git a/changelogs/unreleased/28093-snippet-and-issue-spam-check-on-edit.yml b/changelogs/unreleased/28093-snippet-and-issue-spam-check-on-edit.yml
deleted file mode 100644
index d70b5ef8fd5..00000000000
--- a/changelogs/unreleased/28093-snippet-and-issue-spam-check-on-edit.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Spam check and reCAPTCHA improvements
-merge_request:
-author:
diff --git a/changelogs/unreleased/28212-avoid-dos-on-build-trace.yml b/changelogs/unreleased/28212-avoid-dos-on-build-trace.yml
deleted file mode 100644
index 800e0389c86..00000000000
--- a/changelogs/unreleased/28212-avoid-dos-on-build-trace.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Replace setInterval with setTimeout to prevent highly frequent requests
-merge_request: 9271
-author: Takuya Noguchi
diff --git a/changelogs/unreleased/28357-colon-search.yml b/changelogs/unreleased/28357-colon-search.yml
deleted file mode 100644
index 4bbb0dc12b2..00000000000
--- a/changelogs/unreleased/28357-colon-search.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Allow searching issues for strings containing colons
-merge_request:
-author:
diff --git a/changelogs/unreleased/6073_project_api.yml b/changelogs/unreleased/6073_project_api.yml
new file mode 100644
index 00000000000..fd6792a406e
--- /dev/null
+++ b/changelogs/unreleased/6073_project_api.yml
@@ -0,0 +1,4 @@
+---
+title: 'API project create: Make name or path required'
+merge_request: 9416
+author:
diff --git a/changelogs/unreleased/add-issues-tooltip.yml b/changelogs/unreleased/add-issues-tooltip.yml
deleted file mode 100644
index 58adb6c6b5a..00000000000
--- a/changelogs/unreleased/add-issues-tooltip.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Disabled tooltip on add issues button in usse boards
-merge_request:
-author:
diff --git a/changelogs/unreleased/commit-search-ui-fix.yml b/changelogs/unreleased/commit-search-ui-fix.yml
deleted file mode 100644
index 4a5c2cf6090..00000000000
--- a/changelogs/unreleased/commit-search-ui-fix.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Fixed commit search UI
-merge_request:
-author:
diff --git a/changelogs/unreleased/issue-tags-layout.yml b/changelogs/unreleased/issue-tags-layout.yml
new file mode 100644
index 00000000000..abf4a609932
--- /dev/null
+++ b/changelogs/unreleased/issue-tags-layout.yml
@@ -0,0 +1,4 @@
+---
+title: Fix 'New Tag' layout on Tags page
+merge_request:
+author: Robert Marcano
diff --git a/changelogs/unreleased/issue_25112.yml b/changelogs/unreleased/issue_25112.yml
deleted file mode 100644
index c43d2732b9a..00000000000
--- a/changelogs/unreleased/issue_25112.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Disable invalid service templates
-merge_request:
-author:
diff --git a/changelogs/unreleased/issue_28051_2.yml b/changelogs/unreleased/issue_28051_2.yml
deleted file mode 100644
index 8cc32ad8493..00000000000
--- a/changelogs/unreleased/issue_28051_2.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Use default branch as target_branch when parameter is missing
-merge_request:
-author:
diff --git a/changelogs/unreleased/pages-0-3-2.yml b/changelogs/unreleased/pages-0-3-2.yml
deleted file mode 100644
index f660379f2e6..00000000000
--- a/changelogs/unreleased/pages-0-3-2.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Upgrade GitLab Pages to v0.3.2
-merge_request:
-author:
diff --git a/changelogs/unreleased/zj-fix-slash-command-labels.yml b/changelogs/unreleased/zj-fix-slash-command-labels.yml
deleted file mode 100644
index 93b7194dd4e..00000000000
--- a/changelogs/unreleased/zj-fix-slash-command-labels.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Chat slash commands show labels correctly
-merge_request:
-author:
diff --git a/doc/api/projects.md b/doc/api/projects.md
index 1a8c0ae758f..5de23908b42 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -435,8 +435,8 @@ Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
-| `name` | string | yes | The name of the new project |
-| `path` | string | no | Custom repository name for new project. By default generated based on name |
+| `name` | string | yes if path is not provided | The name of the new project. Equals path if not provided. |
+| `path` | string | yes if name is not provided | Repository name for new project. Generated based on name if not provided (generated lowercased with dashes). |
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
| `description` | string | no | Short project description |
| `issues_enabled` | boolean | no | Enable issues for this project |
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 310a896e958..b8a8cee0cea 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -94,8 +94,9 @@ module API
success Entities::Project
end
params do
- requires :name, type: String, desc: 'The name of the project'
+ optional :name, type: String, desc: 'The name of the project'
optional :path, type: String, desc: 'The path of the repository'
+ at_least_one_of :name, :path
use :optional_params
use :create_params
end
diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb
index f3cd0b22e9b..881d52e4aa4 100644
--- a/lib/api/v3/projects.rb
+++ b/lib/api/v3/projects.rb
@@ -172,8 +172,9 @@ module API
success ::API::Entities::Project
end
params do
- requires :name, type: String, desc: 'The name of the project'
+ optional :name, type: String, desc: 'The name of the project'
optional :path, type: String, desc: 'The path of the repository'
+ at_least_one_of :name, :path
use :optional_params
use :create_params
end
diff --git a/spec/models/project_group_link_spec.rb b/spec/models/project_group_link_spec.rb
index 59a4ae1b799..9b711bfc007 100644
--- a/spec/models/project_group_link_spec.rb
+++ b/spec/models/project_group_link_spec.rb
@@ -7,12 +7,27 @@ describe ProjectGroupLink do
end
describe "Validation" do
- let!(:project_group_link) { create(:project_group_link) }
+ let(:parent_group) { create(:group) }
+ let(:group) { create(:group, parent: parent_group) }
+ let(:project) { create(:project, group: group) }
+ let!(:project_group_link) { create(:project_group_link, project: project) }
it { should validate_presence_of(:project_id) }
it { should validate_uniqueness_of(:group_id).scoped_to(:project_id).with_message(/already shared/) }
it { should validate_presence_of(:group) }
it { should validate_presence_of(:group_access) }
+
+ it "doesn't allow a project to be shared with the group it is in" do
+ project_group_link.group = group
+
+ expect(project_group_link).not_to be_valid
+ end
+
+ it "doesn't allow a project to be shared with an ancestor of the group it is in" do
+ project_group_link.group = parent_group
+
+ expect(project_group_link).not_to be_valid
+ end
end
describe "destroying a record", truncate: true do
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index d2acce90a24..3a00d974633 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -269,10 +269,37 @@ describe API::Projects, api: true do
end
end
- it 'creates new project without path and return 201' do
- expect { post api('/projects', user), name: 'foo' }.
+ it 'creates new project without path but with name and returns 201' do
+ expect { post api('/projects', user), name: 'Foo Project' }.
+ to change { Project.count }.by(1)
+ expect(response).to have_http_status(201)
+
+ project = Project.first
+
+ expect(project.name).to eq('Foo Project')
+ expect(project.path).to eq('foo-project')
+ end
+
+ it 'creates new project without name but with path and returns 201' do
+ expect { post api('/projects', user), path: 'foo_project' }.
to change { Project.count }.by(1)
expect(response).to have_http_status(201)
+
+ project = Project.first
+
+ expect(project.name).to eq('foo_project')
+ expect(project.path).to eq('foo_project')
+ end
+
+ it 'creates new project name and path and returns 201' do
+ expect { post api('/projects', user), path: 'foo-Project', name: 'Foo Project' }.
+ to change { Project.count }.by(1)
+ expect(response).to have_http_status(201)
+
+ project = Project.first
+
+ expect(project.name).to eq('Foo Project')
+ expect(project.path).to eq('foo-Project')
end
it 'creates last project before reaching project limit' do
@@ -281,7 +308,7 @@ describe API::Projects, api: true do
expect(response).to have_http_status(201)
end
- it 'does not create new project without name and return 400' do
+ it 'does not create new project without name or path and returns 400' do
expect { post api('/projects', user) }.not_to change { Project.count }
expect(response).to have_http_status(400)
end
diff --git a/spec/requests/api/v3/projects_spec.rb b/spec/requests/api/v3/projects_spec.rb
index 662be3f3531..34940b2f1c7 100644
--- a/spec/requests/api/v3/projects_spec.rb
+++ b/spec/requests/api/v3/projects_spec.rb
@@ -309,10 +309,37 @@ describe API::V3::Projects, api: true do
end
end
- it 'creates new project without path and return 201' do
- expect { post v3_api('/projects', user), name: 'foo' }.
+ it 'creates new project without path but with name and returns 201' do
+ expect { post v3_api('/projects', user), name: 'Foo Project' }.
to change { Project.count }.by(1)
expect(response).to have_http_status(201)
+
+ project = Project.first
+
+ expect(project.name).to eq('Foo Project')
+ expect(project.path).to eq('foo-project')
+ end
+
+ it 'creates new project without name but with path and returns 201' do
+ expect { post v3_api('/projects', user), path: 'foo_project' }.
+ to change { Project.count }.by(1)
+ expect(response).to have_http_status(201)
+
+ project = Project.first
+
+ expect(project.name).to eq('foo_project')
+ expect(project.path).to eq('foo_project')
+ end
+
+ it 'creates new project name and path and returns 201' do
+ expect { post v3_api('/projects', user), path: 'foo-Project', name: 'Foo Project' }.
+ to change { Project.count }.by(1)
+ expect(response).to have_http_status(201)
+
+ project = Project.first
+
+ expect(project.name).to eq('Foo Project')
+ expect(project.path).to eq('foo-Project')
end
it 'creates last project before reaching project limit' do
@@ -321,7 +348,7 @@ describe API::V3::Projects, api: true do
expect(response).to have_http_status(201)
end
- it 'does not create new project without name and return 400' do
+ it 'does not create new project without name or path and return 400' do
expect { post v3_api('/projects', user) }.not_to change { Project.count }
expect(response).to have_http_status(400)
end