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'); nextStepButton = jQuery('#mailpoet-export-button');
const templateRendered = (option) => { const templateRendered = (option) => {
let tpl = ''; let tpl = `<span class="mailpoet-form-select2-text"><span>${option.name}</span></span>`;
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>`;
if (option.count !== undefined) { if (option.count !== undefined) {
tpl += `<span class="mailpoet-form-select2-count">${option.count}</span>`; tpl += `<span class="mailpoet-form-select2-count">${option.count}</span>`;
} }

View File

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

View File

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

View File

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