Fix code issues

[MAILPOET-1145]
This commit is contained in:
Pavel Dohnal
2018-02-20 09:39:14 +00:00
parent 989baf2aa4
commit adb579a26c
4 changed files with 18 additions and 10 deletions

View File

@@ -24,7 +24,7 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
// set date format // set date format
f = block.hash.format || 'MMM Do, YYYY'; f = block.hash.format || 'MMM Do, YYYY';
// check if we passed a timestamp // check if we passed a timestamp
if (/^\d+$/.test(timestamp)) { if (/^\s*\d+\s*$/.test(timestamp)) {
return window.moment.unix(timestamp).format(f); return window.moment.unix(timestamp).format(f);
} }
return window.moment.utc(timestamp).format(f); return window.moment.utc(timestamp).format(f);

View File

@@ -46,8 +46,10 @@ define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
jQuery('#logger').append('<span class="error_msg">' + MailPoet.MP2Migrator.fatal_error + '</span>' + '<br />\n'); jQuery('#logger').append('<span class="error_msg">' + MailPoet.MP2Migrator.fatal_error + '</span>' + '<br />\n');
}).always(function () { }).always(function () {
if (MailPoet.MP2Migrator.is_logging) { if (MailPoet.MP2Migrator.is_logging) {
MailPoet.MP2Migrator.displayLogs_timeout MailPoet.MP2Migrator.displayLogs_timeout = setTimeout(
= setTimeout(MailPoet.MP2Migrator.displayLogs, 1000); MailPoet.MP2Migrator.displayLogs,
1000
);
} }
}); });
}, },
@@ -71,8 +73,10 @@ define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
jQuery('#logger-container').show(); jQuery('#logger-container').show();
} }
if (MailPoet.MP2Migrator.is_logging) { if (MailPoet.MP2Migrator.is_logging) {
MailPoet.MP2Migrator.updateProgressbar_timeout MailPoet.MP2Migrator.updateProgressbar_timeout = setTimeout(
= setTimeout(MailPoet.MP2Migrator.updateProgressbar, 1000); MailPoet.MP2Migrator.updateProgressbar,
1000
);
} }
}); });
}, },

View File

@@ -20,9 +20,10 @@ define([
columnLimit: 3 columnLimit: 3
}, },
onRender: function () { onRender: function () {
var dragAndDropDisabled = var dragAndDropDisabled = (
_.isObject(this.view.options.renderOptions) _.isObject(this.view.options.renderOptions)
&& this.view.options.renderOptions.disableDragAndDrop === true; && this.view.options.renderOptions.disableDragAndDrop === true
);
if (!dragAndDropDisabled) { if (!dragAndDropDisabled) {
this.addDropZone(); this.addDropZone();
} }

View File

@@ -247,9 +247,12 @@ define(
// if the header options is set, there should be at least // if the header options is set, there should be at least
// 2 data rows, otherwise at least 1 data row // 2 data rows, otherwise at least 1 data row
if ( if (
(processedSubscribers && (isHeaderFound && processedSubscribers.length >= 2)) processedSubscribers &&
|| (
(!isHeaderFound && processedSubscribers.length >= 1) (isHeaderFound && processedSubscribers.length >= 2)
||
(!isHeaderFound && processedSubscribers.length >= 1)
)
) { ) {
// since we assume that the header line is always present, we need // since we assume that the header line is always present, we need
// to detect the header by checking if it contains a valid e-mail address // to detect the header by checking if it contains a valid e-mail address