gitlab-org--gitlab-foss/app/controllers/projects/labels_controller.rb
Dmitriy Zaporozhets 4e249dadb5
Fix 500 error when generate labels on labels page. Fixes #1311
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-04 11:08:21 +03:00

31 lines
684 B
Ruby

class Projects::LabelsController < Projects::ApplicationController
before_filter :module_enabled
before_filter :authorize_labels!
respond_to :js, :html
def index
@labels = @project.issues_labels
end
def generate
Gitlab::IssuesLabels.generate(@project)
if params[:redirect] == 'issues'
redirect_to project_issues_path(@project)
elsif params[:redirect] == 'merge_requests'
redirect_to project_merge_requests_path(@project)
else
redirect_to project_labels_path(@project)
end
end
protected
def module_enabled
unless @project.issues_enabled || @project.merge_requests_enabled
return render_404
end
end
end