Remove unnecessary duplicated 'text' property

[MAILPOET-3073]
This commit is contained in:
Ján Mikláš
2020-10-28 15:14:25 +01:00
committed by Veljko V
parent 88e088c07e
commit 4045fba527
4 changed files with 2 additions and 30 deletions

View File

@@ -35,11 +35,7 @@ jQuery(document).ready(function documentReady() {
nextStepButton = jQuery('#mailpoet-export-button');
const templateRendered = (option) => {
let tpl = '';
if (option.tag !== undefined) {
tpl += `<span class="mailpoet-form-select2-tag">${option.tag}</span>`;
}
tpl += `<span class="mailpoet-form-select2-text"><span>${option.text}</span></span>`;
let tpl = `<span class="mailpoet-form-select2-text"><span>${option.name}</span></span>`;
if (option.count !== undefined) {
tpl += `<span class="mailpoet-form-select2-count">${option.count}</span>`;
}

View File

@@ -8,11 +8,7 @@ export function createSelection(segments, onSelectionChange) {
return;
}
const templateRendered = (option) => {
let tpl = '';
if (option.tag) {
tpl += `<span class="mailpoet-form-select2-tag">${option.tag}</span>`;
}
tpl += `<span class="mailpoet-form-select2-text"><span>${option.text}</span></span>`;
let tpl = `<span class="mailpoet-form-select2-text"><span>${option.name}</span></span>`;
if (option.count) {
tpl += `<span class="mailpoet-form-select2-count">${option.count}</span>`;
}

View File

@@ -40,7 +40,6 @@ class ImportExportFactory {
return [
'id' => $segment['id'],
'name' => $segment['name'],
'text' => $segment['name'], // Required select2 property
'count' => $segment['subscribers'],
];
}, $segments);
@@ -70,7 +69,6 @@ class ImportExportFactory {
return [
'id' => $fieldId,
'name' => $fieldName,
'text' => $fieldName,
'type' => ($fieldId === 'confirmed_at') ? 'date' : null,
'custom' => false,
];
@@ -86,7 +84,6 @@ class ImportExportFactory {
return [
'id' => $field['id'],
'name' => $field['name'],
'text' => $field['name'],
'type' => $field['type'],
'params' => unserialize($field['params']),
'custom' => true,
@@ -102,42 +99,35 @@ class ImportExportFactory {
[
'id' => 'ignore',
'name' => __('Ignore field...', 'mailpoet'),
'text' => __('Ignore field...', 'mailpoet'),
],
[
'id' => 'create',
'name' => __('Create new field...', 'mailpoet'),
'text' => __('Create new field...', 'mailpoet'),
],
] :
[
[
'id' => 'select',
'name' => __('Select all...', 'mailpoet'),
'text' => __('Select all...', 'mailpoet'),
],
[
'id' => 'deselect',
'name' => __('Deselect all...', 'mailpoet'),
'text' => __('Deselect all...', 'mailpoet'),
],
];
$select2Fields = [
[
'name' => __('Actions', 'mailpoet'),
'text' => __('Actions', 'mailpoet'),
'children' => $actions,
],
[
'name' => __('System fields', 'mailpoet'),
'text' => __('System fields', 'mailpoet'),
'children' => $this->formatSubscriberFields($subscriberFields),
],
];
if ($subscriberCustomFields) {
array_push($select2Fields, [
'name' => __('User fields', 'mailpoet'),
'text' => __('User fields', 'mailpoet'),
'children' => $this->formatSubscriberCustomFields(
$subscriberCustomFields
),

View File

@@ -176,23 +176,19 @@ class ImportExportFactoryTest extends \MailPoetTest {
$select2FieldsWithoutCustomFields = [
[
'name' => 'Actions',
'text' => 'Actions',
'children' => [
[
'id' => 'ignore',
'name' => 'Ignore field...',
'text' => 'Ignore field...',
],
[
'id' => 'create',
'name' => 'Create new field...',
'text' => 'Create new field...',
],
],
],
[
'name' => 'System fields',
'text' => 'System fields',
'children' => $importExportFactory->formatSubscriberFields(
$importExportFactory->getSubscriberFields()
),
@@ -203,7 +199,6 @@ class ImportExportFactoryTest extends \MailPoetTest {
[
[
'name' => 'User fields',
'text' => 'User fields',
'children' => $importExportFactory->formatSubscriberCustomFields(
$importExportFactory->getSubscriberCustomFields()
),
@@ -226,23 +221,19 @@ class ImportExportFactoryTest extends \MailPoetTest {
$select2FieldsWithoutCustomFields = [
[
'name' => 'Actions',
'text' => 'Actions',
'children' => [
[
'id' => 'select',
'name' => 'Select all...',
'text' => 'Select all...',
],
[
'id' => 'deselect',
'name' => 'Deselect all...',
'text' => 'Deselect all...',
],
],
],
[
'name' => 'System fields',
'text' => 'System fields',
'children' => $importExportFactory->formatSubscriberFields(
$importExportFactory->getSubscriberFields()
),
@@ -253,7 +244,6 @@ class ImportExportFactoryTest extends \MailPoetTest {
[
[
'name' => 'User fields',
'text' => 'User fields',
'children' => $importExportFactory->formatSubscriberCustomFields(
$importExportFactory->getSubscriberCustomFields()
),