allow course_search end point without catalog enabled

fixes CNVS-20972

test plan
 - go to /api/v1/search/all_courses
 - it should not 404

Change-Id: Iaafb4ba8f2cecbd558be089e79291f08c80da6aa
Reviewed-on: https://gerrit.instructure.com/57553
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
This commit is contained in:
Rob Orton 2015-07-01 13:05:25 -06:00
parent 7df65d1207
commit cebcc0b15b
2 changed files with 7 additions and 6 deletions

View File

@ -181,12 +181,7 @@ class SearchController < ApplicationController
# Only return courses that allow self enrollment. Defaults to false.
#
def all_courses
unless @domain_root_account.feature_enabled?(:course_catalog)
return render status: 404, template: "shared/errors/404_message"
end
@courses = Course
.where(root_account_id: @domain_root_account)
@courses = Course.where(root_account_id: @domain_root_account)
.where(indexed: true)
.where(workflow_state: 'available')
.order('created_at')

View File

@ -40,4 +40,10 @@ describe "course catalog" do
courses = course_elements
expect(courses.size).to eql 1
end
it "should work without course catalog" do
Account.default.disable_feature!(:course_catalog)
courses = course_elements
expect(courses.size).to eql 1
end
end