import all pronouns

SIS is considered source of truth, and sis may change pronouns and don't
want to manage a second list of accepted pronouns

test plan
 - run sis import with pronoun
 - it should add it even when not in account list

fixes VICE-838
flag = none

Change-Id: I51804ac73c8a1934d5c135c736de0a3dfa6131b2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248782
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Rob Orton 2020-09-28 13:23:23 -06:00
parent f9fa2d57a0
commit 968347af50
3 changed files with 6 additions and 15 deletions

View File

@ -273,7 +273,7 @@ still be provided.</td>
<td>text</td>
<td></td>
<td></td>
<td>User's preferred pronouns. Accepted values are determined by the account settings.</td>
<td>User's preferred pronouns.</td>
</tr>
<tr>
<td>status</td>

View File

@ -213,16 +213,7 @@ module SIS
should_add_account_associations = false
should_update_account_associations = false
if user_row.pronouns.present? &&
@root_account.pronouns.include?(user_row.pronouns)
unless user.stuck_sis_fields.include?(:pronouns)
user.pronouns = user_row.pronouns
end
elsif user_row.pronouns.present?
message = I18n.t("Pronoun does not match account pronoun or pronouns are not enabled for this account, %{user_id}, skipping", user_id: user_row.user_id)
@messages << SisBatch.build_error(user_row.csv, message, sis_batch: @batch, row: user_row.lineno, row_info: user_row.row)
next
end
user.pronouns = user_row.pronouns if user_row.pronouns.present? && !user.stuck_sis_fields.include?(:pronouns)
if !status_is_active && !user.new_record?
if user.id == @batch&.user_id

View File

@ -243,13 +243,13 @@ describe SIS::CSV::UserImporter do
expect(user.pronouns).to eq 'mr/man'
end
it "should throw an error when pronouns don't match" do
importer = process_csv_data(
it "should add pronouns when not in account list" do
process_csv_data_cleanly(
"user_id,login_id,full_name,status,pronouns",
"user_1,user1,tom riddle,active,mr/man"
)
error = "Pronoun does not match account pronoun or pronouns are not enabled for this account, user_1, skipping"
expect(importer.errors.map(&:last).first).to eq error
user = Pseudonym.by_unique_id('user1').first.user
expect(user.pronouns).to eq 'mr/man'
end
it "respects users set pronouns cause it's sticky" do