scrub commas from user names sent to crocodoc, fixes #11137

crocodoc does not allow viewing sessions to be created when the user
name sent to crocodoc has a comma, we need to scrub it out.

test-plan:
* as a student, submit a crocodocable file as a submission
* change the teacher short name(display name) to have a comma
* make annotations on the student submission as the teacher
* view teacher annotations as the student
* during both viewing sessions, the teacher's name on the annotiations
should not have a comma

Change-Id: Iebfc7f8137ea8e49fef139fdfec932bdb464d85d
Reviewed-on: https://gerrit.instructure.com/14208
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
Bryan Madsen 2012-08-21 13:32:43 -06:00
parent 252d35688c
commit a9b83fea43
2 changed files with 7 additions and 1 deletions

View File

@ -2571,7 +2571,7 @@ class User < ActiveRecord::Base
end
def crocodoc_user
"#{crocodoc_id!},#{short_name}"
"#{crocodoc_id!},#{short_name.gsub(",","")}"
end
# mfa settings for a user are the most restrictive of any pseudonyms the user has

View File

@ -1886,6 +1886,12 @@ describe User do
@user.crocodoc_user.should eql '999,Bob'
end
it "should scrub commas from the user name" do
@user.short_name = "Smith, Bob"
@user.save!
@user.crocodoc_user.should eql '999,Smith Bob'
end
it "should not change a user's crocodoc_id" do
@user.update_attribute :crocodoc_id, 2
@user.crocodoc_id!.should eql 2