fix segments loaded on subscribers page + removed counts for bulk actions' segments
This commit is contained in:
@@ -73,7 +73,7 @@ define(
|
||||
});
|
||||
},
|
||||
filter: function(segment) {
|
||||
return !!(!segment.deleted_at);
|
||||
return !!(!segment.deleted_at && segment.type === 'default');
|
||||
},
|
||||
getSearchLabel: function(segment, subscriber) {
|
||||
let label = '';
|
||||
|
@@ -106,11 +106,6 @@ const bulk_actions = [
|
||||
return !!(
|
||||
!segment.deleted_at && segment.type === 'default'
|
||||
);
|
||||
},
|
||||
getLabel: function (segment) {
|
||||
return (segment.subscribers > 0) ?
|
||||
segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')' :
|
||||
segment.name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -142,11 +137,6 @@ const bulk_actions = [
|
||||
return !!(
|
||||
!segment.deleted_at && segment.type === 'default'
|
||||
);
|
||||
},
|
||||
getLabel: function (segment) {
|
||||
return (segment.subscribers > 0) ?
|
||||
segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')' :
|
||||
segment.name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -178,11 +168,6 @@ const bulk_actions = [
|
||||
return !!(
|
||||
segment.type === 'default'
|
||||
);
|
||||
},
|
||||
getLabel: function (segment) {
|
||||
return (segment.subscribers > 0) ?
|
||||
segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')' :
|
||||
segment.name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -234,14 +219,17 @@ const item_actions = [
|
||||
{
|
||||
name: 'edit',
|
||||
label: MailPoet.I18n.t('edit'),
|
||||
link: function(item) {
|
||||
link: function(subscriber) {
|
||||
return (
|
||||
<Link to={ `/edit/${item.id}` }>{MailPoet.I18n.t('edit')}</Link>
|
||||
<Link to={ `/edit/${subscriber.id}` }>{MailPoet.I18n.t('edit')}</Link>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'trash'
|
||||
name: 'trash',
|
||||
display: function(subscriber) {
|
||||
return !!(~~subscriber.wp_user_id === 0);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -280,15 +268,11 @@ const SubscriberList = React.createClass({
|
||||
}
|
||||
|
||||
let segments = false;
|
||||
let subscribed_segments = [];
|
||||
|
||||
// WordPress Users
|
||||
if (~~(subscriber.wp_user_id) > 0) {
|
||||
subscribed_segments.push(MailPoet.I18n.t('WPUsersSegment'));
|
||||
}
|
||||
|
||||
// Subscriptions
|
||||
if (subscriber.subscriptions.length > 0) {
|
||||
let subscribed_segments = [];
|
||||
|
||||
subscriber.subscriptions.map((subscription) => {
|
||||
const segment = this.getSegmentFromId(subscription.segment_id);
|
||||
if(segment === false) return;
|
||||
@@ -296,13 +280,14 @@ const SubscriberList = React.createClass({
|
||||
subscribed_segments.push(segment.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
segments = (
|
||||
<span>
|
||||
{ subscribed_segments.join(', ') }
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
let avatar = false;
|
||||
if(subscriber.avatar_url) {
|
||||
|
@@ -355,7 +355,7 @@ class Menu {
|
||||
$data = array();
|
||||
|
||||
$data['items_per_page'] = $this->getLimitPerPage('subscribers');
|
||||
$data['segments'] = Segment::getSegmentsWithSubscriberCount();
|
||||
$data['segments'] = Segment::findArray();
|
||||
|
||||
$data['custom_fields'] = array_map(function($field) {
|
||||
$field['params'] = unserialize($field['params']);
|
||||
@@ -484,7 +484,7 @@ class Menu {
|
||||
);
|
||||
}
|
||||
|
||||
function getLimitPerPage($model = null) {
|
||||
private function getLimitPerPage($model = null) {
|
||||
if($model === null) {
|
||||
return Listing\Handler::DEFAULT_LIMIT_PER_PAGE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user