Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Changed error messages, comment moved to more meaningfull place

Co-authored-by: Zoltán Lehóczky <[email protected]>
  • Loading branch information
sobotama and Piedone authored Apr 24, 2024
1 parent ac4cc50 commit 9e249c2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ public override async Task<IDisplayResult> UpdateAsync(JavascriptCondition condi
var model = new JavascriptConditionViewModel();
await updater.TryUpdateModelAsync(model, Prefix);

// CodeMirror hides the textarea which displays the error when updater.ModelState.AddModelError() is used,
// that's why a notifier is used to show validation errors.
if (string.IsNullOrWhiteSpace(model.Script))
{
updater.ModelState.AddModelError(Prefix, nameof(model.Script), S["The script is required"]);
// Codemirror hides the textarea which displays the error when updater.ModelState.AddModelError is used, that's why a notifier is used to show the error to user
await _notifier.ErrorAsync(H["The script is required"]);
updater.ModelState.AddModelError(Prefix, nameof(model.Script), S["Please provide a script."]);
await _notifier.ErrorAsync(H["Please provide a script."]);
return Edit(condition);
}

Expand Down

0 comments on commit 9e249c2

Please sign in to comment.