don't 500 when passing nothing into user_search

test plan
 - specs should pass

fixes VICE-2057
flag=none

Change-Id: Ieafc0fbf2e0665ee0fb8ba89359329e14f18a2c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/273090
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
This commit is contained in:
Rob Orton 2021-09-07 16:09:52 -06:00
parent 021d3958ea
commit d822ac00cc
2 changed files with 8 additions and 1 deletions

View File

@ -53,6 +53,7 @@ class UserList
@initial_type = initial_type
@search_method = (@root_account.open_registration? ? :open : :closed) if @search_method == :infer
@current_user = current_user
list_in ||= ''
parse_list(list_in)
resolve
end

View File

@ -40,6 +40,12 @@ describe UserList do
expect(ul.addresses.map{|x| [x[:name], x[:address]]}).to eq [["senor molé", "blah@instructure.com"]]
end
it "should not cause error with nothing past to it" do
ul = UserList.new(nil)
expect(ul.errors).to eq []
expect(ul.addresses.map{|x| [x[:name], x[:address]]}).to eq []
end
it "should find by SMS number" do
user_with_pseudonym(:name => "JT", :active_all => 1)
communication_channel(@user, {username: '8015555555@txt.att.net', path_type: 'sms', active_cc: true})