diff options
author | Rémy Coutable <remy@rymai.me> | 2016-10-06 09:33:11 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-10-06 09:33:11 +0300 |
commit | d51bb99a7e7c4dce4abefbf4967aa69054066c3b (patch) | |
tree | a6aba13ef5161890bbebd0b48bfc36ad3d8f8223 /app/controllers | |
parent | 7e493b11546f15f7871a249474edf6afd418af89 (diff) | |
parent | 3f57ea0c0ba55f2612997acfb531f83a70b73323 (diff) |
Merge commit 'dev/security' into 'master'
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/labels_controller.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 28fa4a5b141..a6626df4826 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -30,9 +30,15 @@ class Projects::LabelsController < Projects::ApplicationController @label = @project.labels.create(label_params) if @label.valid? - redirect_to namespace_project_labels_path(@project.namespace, @project) + respond_to do |format| + format.html { redirect_to namespace_project_labels_path(@project.namespace, @project) } + format.json { render json: @label } + end else - render 'new' + respond_to do |format| + format.html { render 'new' } + format.json { render json: { message: @label.errors.messages }, status: 400 } + end end end |