Skip to content

Commit

Permalink
clear prior message; msg tweak for empty field
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony committed Sep 28, 2023
1 parent 5998144 commit 0161c22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/fse.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ exports.FullScreenEditorModule =
var newFocusViewId;
if (errMsgView) {
if (err) {
errMsgView.clearText();
errMsgView.setText(err.message);

if (MciViewIds.header.subject === err.view.getId()) {
Expand Down
8 changes: 7 additions & 1 deletion core/system_view_validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ exports.validateEmailAvail = validateEmailAvail;
exports.validateBirthdate = validateBirthdate;
exports.validatePasswordSpec = validatePasswordSpec;

const emptyFieldError = () => new Error('Field cannot be empty');

function validateNonEmpty(data, cb) {
return cb(data && data.length > 0 ? null : new Error('Field cannot be empty'));
return cb(data && data.length > 0 ? null : emptyFieldError);
}

function validateMessageSubject(data, cb) {
Expand Down Expand Up @@ -91,6 +93,10 @@ function validateGeneralMailAddressedTo(data, cb) {
// :TODO: remove hard-coded FTN check here. We need a decent way to register global supported flavors with modules.
const addressedToInfo = getAddressedToInfo(data);

if (addressedToInfo.name.length === 0) {
return cb(emptyFieldError());
}

if (Message.AddressFlavor.Local !== addressedToInfo.flavor) {
return cb(null);
}
Expand Down

0 comments on commit 0161c22

Please sign in to comment.