diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 341920097..8e492a62f 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -24,7 +24,7 @@ class Projects::IssuesController < Projects::BaseController @sort = params[:sort] == 'updated' ? :updated : :created @direction = params[:direction] == 'asc' ? :asc : :desc @issues = @issues.order("issues.#{@sort}_at #{@direction}") - @issues = @issues.includes(:assignee, :user, :pull_request).uniq + @issues = @issues.preload(:assignee, :user, :pull_request).uniq .paginate per_page: 20, page: params[:page] if status == 200 render 'index', layout: request.xhr? ? 'with_sidebar' : 'application' @@ -81,11 +81,11 @@ class Projects::IssuesController < Projects::BaseController end end - def destroy - @issue.destroy - flash[:notice] = t("flash.issue.destroyed") - redirect_to root_path - end + # def destroy + # @issue.destroy + # flash[:notice] = t("flash.issue.destroyed") + # redirect_to root_path + # end def create_label index(@project.labels.create!(name: params[:name], color: params[:color]) ? 200 : 500) diff --git a/app/models/labeling.rb b/app/models/labeling.rb index 972f44342..1d8720fb6 100644 --- a/app/models/labeling.rb +++ b/app/models/labeling.rb @@ -1,4 +1,6 @@ class Labeling < ActiveRecord::Base belongs_to :issue belongs_to :label + + attr_accessible :label_id end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 7d1351602..0777b3384 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -115,16 +115,16 @@ shared_examples_for 'user without issue update rights' do end end -shared_examples_for 'user without issue destroy rights' do - it 'should not be able to perform destroy action' do - delete :destroy, id: @issue.serial_id, name_with_owner: @project.name_with_owner - response.should redirect_to(controller.current_user ? forbidden_path : new_user_session_path) - end +# shared_examples_for 'user without issue destroy rights' do +# it 'should not be able to perform destroy action' do +# delete :destroy, id: @issue.serial_id, name_with_owner: @project.name_with_owner +# response.should redirect_to(controller.current_user ? forbidden_path : new_user_session_path) +# end - it 'should not reduce issues count' do - lambda{ delete :destroy, id: @issue.serial_id, name_with_owner: @project.name_with_owner }.should_not change{ Issue.count } - end -end +# it 'should not reduce issues count' do +# lambda{ delete :destroy, id: @issue.serial_id, name_with_owner: @project.name_with_owner }.should_not change{ Issue.count } +# end +# end shared_examples_for 'project with issues turned off' do it 'should not be able to perform index action' do @@ -152,7 +152,7 @@ describe Projects::IssuesController do it_should_behave_like 'issue user with project writer rights' it_should_behave_like 'user with issue update rights' it_should_behave_like 'project with issues turned off' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' end context 'for project admin user' do @@ -165,7 +165,7 @@ describe Projects::IssuesController do it_should_behave_like 'issue user with project writer rights' it_should_behave_like 'user with issue update rights' it_should_behave_like 'project with issues turned off' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' end context 'for project owner user' do @@ -179,7 +179,7 @@ describe Projects::IssuesController do it_should_behave_like 'issue user with project writer rights' it_should_behave_like 'user with issue update rights' it_should_behave_like 'project with issues turned off' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' end context 'for project reader user' do @@ -191,7 +191,7 @@ describe Projects::IssuesController do it_should_behave_like 'issue user with project reader rights' it_should_behave_like 'user without issue update rights' it_should_behave_like 'project with issues turned off' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' context 'perform create action' do before { post :create, @create_params } @@ -235,7 +235,7 @@ describe Projects::IssuesController do it_should_behave_like 'issue user with project writer rights' it_should_behave_like 'user without issue update rights' it_should_behave_like 'project with issues turned off' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' end context 'for issue assign user' do @@ -245,7 +245,7 @@ describe Projects::IssuesController do it_should_behave_like 'user without issue update rights' it_should_behave_like 'project with issues turned off' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' end context 'for guest' do @@ -292,6 +292,6 @@ describe Projects::IssuesController do end it_should_behave_like 'user without issue update rights' - it_should_behave_like 'user without issue destroy rights' + # it_should_behave_like 'user without issue destroy rights' end end