@brightspace-hmc/siren-sdk
Advanced tools
Comparing version 2.13.0 to 2.14.0
{ | ||
"name": "@brightspace-hmc/siren-sdk", | ||
"version": "2.13.0", | ||
"version": "2.14.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -45,3 +45,2 @@ import { Actions, Classes, Rels } from '../../hypermedia-constants.js'; | ||
} | ||
_getInstructionsEntity() { | ||
@@ -233,3 +232,3 @@ return this._entity | ||
return !subEntity.hasActionByName(Actions.assignments.setToGroup) && | ||
!subEntity.hasActionByName(Actions.assignments.setToIndividual) ; | ||
!subEntity.hasActionByName(Actions.assignments.setToIndividual); | ||
} | ||
@@ -550,3 +549,3 @@ | ||
const action = this._entity.getActionByName(Actions.assignments.updateCustomAllowableFileType); | ||
const action = this._entity.getActionByName(Actions.assignments.updateCustomAllowableFileType); | ||
if (!action) { | ||
@@ -714,2 +713,35 @@ return; | ||
/** | ||
* @returns {bool} Whether or not the show allow text submission is present on the assignment entity | ||
*/ | ||
showAllowTextSubmission() { | ||
return this._entity && this._entity.properties && this._entity.properties.showAllowTextSubmission; | ||
} | ||
allowTextSubmission() { | ||
return this._entity && this._entity.properties && this._entity.properties.allowTextSubmission; | ||
} | ||
canEditAllowTextSubmission() { | ||
this._entity && this._entity.hasActionByName(Actions.assignments.updateAllowTextSubmission); | ||
} | ||
_formatUpdateAllowTextSubmissionAction(allowTextSubmission) { | ||
if (allowTextSubmission === undefined || !this._hasAllowTextSubmissionChanged(allowTextSubmission)) { | ||
return; | ||
} | ||
const action = this.canEditAllowTextSubmission && this._entity.getActionByName(Actions.assignments.updateAllowTextSubmission); | ||
if (!action) { | ||
return; | ||
} | ||
const fields = [ | ||
{ name: 'allowTextSubmission', value: allowTextSubmission } | ||
]; | ||
return { fields, action }; | ||
} | ||
notificationEmail() { | ||
@@ -737,3 +769,3 @@ const subEntity = this._entity && this._entity.getSubEntityByRel(Rels.Assignments.notificationEmail); | ||
const subEntity = this._entity && this._entity.getSubEntityByRel(Rels.Assignments.notificationEmail); | ||
const action = subEntity && subEntity.getActionByName(Actions.assignments.updateNotificationEmail); | ||
const action = subEntity && subEntity.getActionByName(Actions.assignments.updateNotificationEmail); | ||
if (!action) { | ||
@@ -797,3 +829,3 @@ return; | ||
if (!action) return; | ||
const fields = [ { name: 'isAnonymous', value: isAnonymous } ]; | ||
const fields = [{ name: 'isAnonymous', value: isAnonymous }]; | ||
@@ -841,3 +873,3 @@ return { fields, action }; | ||
const action = annotationsEntity && annotationsEntity.getActionByName(Actions.assignments.updateAnnotationToolsAvailability); | ||
const action = annotationsEntity && annotationsEntity.getActionByName(Actions.assignments.updateAnnotationToolsAvailability); | ||
if (!action) { | ||
@@ -887,2 +919,3 @@ return; | ||
const updateNotificationEmailAction = this._formatUpdateNotificationEmailAction(assignment.notificationEmail); | ||
const updateAllowTextSubmissionAction = this._formatUpdateAllowTextSubmissionAction(assignment.allowTextSubmission); | ||
@@ -902,3 +935,4 @@ const sirenActions = [ | ||
updateDefaultScoringRubricAction, | ||
updateNotificationEmailAction | ||
updateNotificationEmailAction, | ||
updateAllowTextSubmissionAction | ||
]; | ||
@@ -937,2 +971,6 @@ | ||
} | ||
if (assignment.hasOwnProperty('allowTextSubmission')) { | ||
diffs.push([this.allowTextSubmission(), assignment.allowTextSubmission]); | ||
} | ||
for (const [left, right] of diffs) { | ||
@@ -1012,2 +1050,6 @@ if (left !== right) { | ||
_hasAllowTextSubmissionChanged(allowTextSubmission) { | ||
return allowTextSubmission !== this.allowTextSubmission(); | ||
} | ||
_hasSubmissionsRuleChanged(submissionsRule) { | ||
@@ -1014,0 +1056,0 @@ return submissionsRule !== this.submissionsRule(); |
@@ -624,3 +624,4 @@ export const Rels = { | ||
updateDefaultScoringRubric: 'update-default-scoring-rubric', | ||
updateNotificationEmail: 'update-notification-email' | ||
updateNotificationEmail: 'update-notification-email', | ||
updateAllowTextSubmission: 'update-allow-text-submission' | ||
}, | ||
@@ -627,0 +628,0 @@ content: { |
330417
9085