Commit e8da7b80 authored by Marin Jankovski's avatar Marin Jankovski

Merge remote-tracking branch 'CE/master'

Conflicts:
	doc/workflow/README.md
parents 5812cfa1 7f846015
......@@ -4,7 +4,7 @@ class Labels
@setupLabelForm(form)
@cleanBinding()
@addBinding()
@updateColorPreview
@updateColorPreview()
addBinding: ->
$(document).on 'click', '.suggest-colors a', @setSuggestedColor
......
......@@ -3,3 +3,4 @@
- [Authorization for merge requests](authorization_for_merge_requests.md)
- [Groups](groups.md)
- [Share projects with other groups](share_projects_with_other_groups.md)
- [Labels](labels.md)
# Labels
In GitLab, you can easily tag issues and merge requests. If you have permission level `Developer` or higher, you can manage labels. To create, edit or delete a label, go to a project and then to `Issues` and then `Labels`.
Here you can create a new label.
![new label](labels/label1.png)
You can choose to set a color.
![label color](labels/label2.png)
If you want to change an existing label, press edit next to the listed label.
You will be presented with the same form as when creating a new label.
![edit label](labels/label3.png)
......@@ -200,7 +200,7 @@ class Groups < Spinach::FeatureSteps
step 'I should see group milestone with descriptions and expiry date' do
page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry')
page.should have_content('expires at Aug 20, 2014')
page.should have_content('expires at Aug 20, 2114')
end
step 'I should see group milestone with all issues and MRs assigned to that milestone' do
......@@ -249,7 +249,7 @@ class Groups < Spinach::FeatureSteps
milestone2_project3 = create :milestone,
title: "GL-113",
project: @project3,
due_date: '2014-08-20',
due_date: '2114-08-20',
description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry'
@issue1 = create :issue,
project: @project1,
......
......@@ -78,8 +78,8 @@ module API
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
# Validate label names in advance
if validate_label_params(params)
return render_api_error!('Label names invalid', 405)
if (errors = validate_label_params(params)).any?
render_api_error!({ labels: errors }, 400)
end
merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute
......@@ -117,15 +117,16 @@ module API
authorize! :modify_merge_request, merge_request
# Validate label names in advance
if validate_label_params(params)
return render_api_error!('Label names invalid', 405)
if (errors = validate_label_params(params)).any?
render_api_error!({ labels: errors }, 400)
end
merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request)
if merge_request.valid?
# Find or create labels and attach to issue
if params[:labels].present?
unless params[:labels].nil?
merge_request.remove_labels
merge_request.add_labels_by_names(params[:labels].split(","))
end
......
......@@ -112,15 +112,16 @@ describe API::API, api: true do
response.status.should == 400
end
it 'should return 405 on invalid label names' do
it 'should return 400 on invalid label names' do
post api("/projects/#{project.id}/merge_requests", user),
title: 'Test merge_request',
source_branch: 'stable',
target_branch: 'master',
author: user,
labels: 'label, ?'
response.status.should == 405
json_response['message'].should == 'Label names invalid'
response.status.should == 400
json_response['message']['labels']['?']['title'].should ==
['is invalid']
end
end
......@@ -252,13 +253,13 @@ describe API::API, api: true do
json_response['target_branch'].should == 'wiki'
end
it 'should return 405 on invalid label names' do
it 'should return 400 on invalid label names' do
put api("/projects/#{project.id}/merge_request/#{merge_request.id}",
user),
title: 'new issue',
labels: 'label, ?'
response.status.should == 405
json_response['message'].should == 'Label names invalid'
response.status.should == 400
json_response['message']['labels']['?']['title'].should == ['is invalid']
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