Skip to content

Commit 1697508

Browse files
author
Auldrin Possa
committed
TD-5620-Added code to check if the html editor is empty.
1 parent b395ce1 commit 1697508

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

DigitalLearningSolutions.Web/Controllers/FrameworksController/AssessmentQuestions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ public IActionResult EditAssessmentQuestionOptions(AssessmentQuestionDetail asse
456456
return RedirectToAction("EditAssessmentQuestionOptions", "Frameworks", new { frameworkId, assessmentQuestionId, frameworkCompetencyId });
457457
}
458458
assessmentQuestionDetail.ScoringInstructions = SanitizerHelper.SanitizeHtmlData(assessmentQuestionDetail.ScoringInstructions);
459+
if (string.IsNullOrWhiteSpace(StringHelper.StripHtmlTags(assessmentQuestionDetail?.ScoringInstructions))) { assessmentQuestionDetail.ScoringInstructions = null; }
459460
SessionAssessmentQuestion sessionAssessmentQuestion = multiPageFormService
460461
.GetMultiPageFormData<SessionAssessmentQuestion>(MultiPageFormDataFeature.EditAssessmentQuestion, TempData)
461462
.GetAwaiter()

DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public IActionResult AddEditFrameworkCompetencyGroup(int frameworkId, Competency
6565
var adminId = GetAdminId();
6666
var userRole = frameworkService.GetAdminUserRoleForFrameworkId(adminId, frameworkId);
6767
if (userRole < 2) return StatusCode(403);
68+
if (string.IsNullOrWhiteSpace(StringHelper.StripHtmlTags(competencyGroupBase?.Description))) { competencyGroupBase.Description = null; }
6869
if (competencyGroupBase.ID > 0)
6970
{
7071
frameworkService.UpdateFrameworkCompetencyGroup(frameworkCompetencyGroupId, competencyGroupBase.CompetencyGroupID, competencyGroupBase.Name, SanitizerHelper.SanitizeHtmlData
@@ -141,7 +142,7 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompet
141142
frameworkCompetency.Description?.Trim();
142143
var description = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(frameworkCompetency.Description));
143144
var detailFramework = frameworkService.GetDetailFrameworkByFrameworkId(frameworkId, GetAdminId());
144-
if (string.IsNullOrWhiteSpace(description)) { frameworkCompetency.Description = null; }
145+
if (string.IsNullOrWhiteSpace(StringHelper.StripHtmlTags(description))) { frameworkCompetency.Description = null; }
145146
if (!ModelState.IsValid)
146147
{
147148
ModelState.Remove(nameof(FrameworkCompetency.Name));

0 commit comments

Comments
 (0)