Show error notice when trying to delete segment, which is assigned to automated email
[MAILPOET-2352]
This commit is contained in:
committed by
Jack Kitterhing
parent
dad381c74d
commit
0ae466f5fa
@@ -202,7 +202,23 @@ const itemActions = [
|
|||||||
{
|
{
|
||||||
name: 'trash',
|
name: 'trash',
|
||||||
display: function display(segment) {
|
display: function display(segment) {
|
||||||
return !isSpecialSegment(segment);
|
return !isSpecialSegment(segment) && segment.automated_emails_subjects.length === 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'delete',
|
||||||
|
label: MailPoet.I18n.t('moveToTrash'),
|
||||||
|
onClick: function onClick(segment) {
|
||||||
|
MailPoet.Notice.error(
|
||||||
|
MailPoet.I18n.t('trashDisallowed').replace(
|
||||||
|
'%$1s',
|
||||||
|
segment.automated_emails_subjects.map((subject) => `'${subject}'`).join(', ')
|
||||||
|
),
|
||||||
|
{ scroll: true }
|
||||||
|
);
|
||||||
|
},
|
||||||
|
display: function display(segment) {
|
||||||
|
return !isSpecialSegment(segment) && segment.automated_emails_subjects.length > 0;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
'restore': __('Restore'),
|
'restore': __('Restore'),
|
||||||
'deletePermanently': __('Delete permanently'),
|
'deletePermanently': __('Delete permanently'),
|
||||||
'save': __('Save'),
|
'save': __('Save'),
|
||||||
|
'trashDisallowed': _x('List cannot be deleted because it’s used for %$1s email', 'Alert shown when trying to delete segment, which is assigned to any automatic emails.'),
|
||||||
|
|
||||||
'previousPage': __('Previous page'),
|
'previousPage': __('Previous page'),
|
||||||
'firstPage': __('First page'),
|
'firstPage': __('First page'),
|
||||||
|
Reference in New Issue
Block a user