Skip to content

Commit

Permalink
Merge pull request #511 from AnthonyHarwood/fse_err_msg_display_tweak
Browse files Browse the repository at this point in the history
fse err msg display tweak
  • Loading branch information
NuSkooler authored Sep 29, 2023
2 parents a644672 + 0161c22 commit db8bd2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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
2 changes: 1 addition & 1 deletion core/ftn_address.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module.exports = class Address {
static fromString(addrStr) {
const m = FTN_ADDRESS_REGEXP.exec(addrStr);

if (m) {
if (m && m[2] && m[3]) {
// start with a 2D
let addr = {
net: parseInt(m[2]),
Expand Down
10 changes: 8 additions & 2 deletions 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,7 +93,11 @@ 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 (Message.AddressFlavor.FTN === addressedToInfo.flavor) {
if (addressedToInfo.name.length === 0) {
return cb(emptyFieldError());
}

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

Expand Down

0 comments on commit db8bd2f

Please sign in to comment.