add pronouns to assignment overrides picker

Test Plan:
- Turn on pronouns and have a user add some pronouns
- go create an assignment and create some overrides
- notice the pronouns show up appropriately

fixes KNO-156
flag=account_pronouns

Change-Id: I85fe018b8f66623a6f0927e1394fd68867c52a65
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/217750
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Norton <rnorton@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
This commit is contained in:
Steven Burnett 2019-11-18 21:34:06 -07:00
parent 3d0d134a1e
commit 2813f5cf66
4 changed files with 32 additions and 3 deletions

View File

@ -272,7 +272,6 @@ export default class AssignmentListItemView extends Backbone.View
addMigratedQuizToList: (response) =>
return unless response
quizzes = response.migrated_assignment
debugger
if quizzes
@addAssignmentToList(quizzes[0])

View File

@ -138,7 +138,11 @@ class DueDateRow extends React.Component {
nameOrLoading = (collection, id) => {
const item = collection[id]
return item ? item.name : I18n.t('Loading...')
if (item) {
return item.pronouns ? `${item.name} (${item.pronouns})` : item.name
} else {
return I18n.t('Loading...')
}
}
// -------------------

View File

@ -291,7 +291,7 @@ class DueDateTokenWrapper extends React.Component {
const displayName = set.name || this.props.defaultSectionNamer(set.course_section_id)
return (
<ComboboxOption key={set.key || `${displayName}-${index}`} value={set.name} set_props={set}>
{displayName}
{displayName}{set.pronouns && ` (${set.pronouns})`}
</ComboboxOption>
)
}

View File

@ -147,6 +147,32 @@ test('section tokens are given their proper name if loaded', function() {
ok(!!token)
})
test('returns correct name from nameOrLoading', function() {
const collection = {
'2': {
id: '2',
name: 'pronouns student',
created_at: '2019-10-28T07:53:54-06:00',
sortable_name: 'mileaciobonu, felix',
short_name: 'felix mileaciobonu',
pronouns: 'He/Him'
},
'5': {
id: '5',
name: 'no pronounsstudent',
created_at: '2019-11-18T21:31:59-07:00',
sortable_name: 'student, test',
short_name: 'test student'
}
}
const pronounsName = this.dueDateRow.nameOrLoading(collection, '2')
const noPronounsName = this.dueDateRow.nameOrLoading(collection, '5')
const loading = this.dueDateRow.nameOrLoading(collection, '9')
equal(pronounsName, `${collection['2'].name} (${collection['2'].pronouns})`)
equal(noPronounsName, `${collection['5'].name}`)
equal(loading, 'Loading...')
})
test('student tokens are their proper name if loaded', function() {
const tokens = this.dueDateRow.tokenizedOverrides()
const token = tokens.find(t => t.name === 'student name')