diff --git a/app/controllers/api/v1/issues_controller.rb b/app/controllers/api/v1/issues_controller.rb index fe6a767f9..3d2e40cc6 100644 --- a/app/controllers/api/v1/issues_controller.rb +++ b/app/controllers/api/v1/issues_controller.rb @@ -6,6 +6,7 @@ class Api::V1::IssuesController < Api::V1::BaseController load_and_authorize_resource :group, only: :group_index, find_by: :id, parent: false load_and_authorize_resource :project + skip_load_and_authorize_resource :project, only: [:all_index, :user_index, :group_index] load_and_authorize_resource :issue, through: :project, find_by: :serial_id, only: [:show, :update, :create, :index] def index @@ -60,7 +61,7 @@ class Api::V1::IssuesController < Api::V1::BaseController private def render_issues_list - @issues = @issues.includes(:user, :assignee, :labels).without_pull_requests + @issues = @issues.preload(:user, :assignee, :labels, :project).without_pull_requests if params[:status] == 'closed' @issues = @issues.closed else diff --git a/spec/controllers/api/v1/issues_controller_spec.rb b/spec/controllers/api/v1/issues_controller_spec.rb index 6f04c973c..a70ff7873 100644 --- a/spec/controllers/api/v1/issues_controller_spec.rb +++ b/spec/controllers/api/v1/issues_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Api::V1::IssuesController do - before(:all) do + before do stub_symlink_methods any_instance_of(Project, versions: ['v1.0', 'v2.0']) @@ -213,8 +213,4 @@ describe Api::V1::IssuesController do end end - after(:all) do - User.destroy_all - Platform.destroy_all - end end