Listing setParam only needs to be run when url history is specified
- added missing code to deleteManySubscriptions() so that it doesn't remove from all segments
This commit is contained in:
@ -365,42 +365,42 @@ const Listing = React.createClass({
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
setParams: function() {
|
setParams: function() {
|
||||||
let params = Object.keys(this.state)
|
|
||||||
.filter(key => {
|
|
||||||
return (
|
|
||||||
[
|
|
||||||
'group',
|
|
||||||
'filter',
|
|
||||||
'search',
|
|
||||||
'page',
|
|
||||||
'sort_by',
|
|
||||||
'sort_order'
|
|
||||||
].indexOf(key) !== -1
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.map(key => {
|
|
||||||
let value = this.state[key];
|
|
||||||
if (value === Object(value)) {
|
|
||||||
value = jQuery.param(value)
|
|
||||||
} else if (value === Boolean(value)) {
|
|
||||||
value = value.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value !== '' && value !== null) {
|
|
||||||
return `${key}[${value}]`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.filter(key => { return (key !== undefined) })
|
|
||||||
.join('/');
|
|
||||||
|
|
||||||
// prepend with tab is specified
|
|
||||||
if (this.props.tab !== undefined) {
|
|
||||||
params = `/${ this.props.tab }/${ params }`;
|
|
||||||
} else {
|
|
||||||
params = `/${ params }`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.props.location) {
|
if (this.props.location) {
|
||||||
|
let params = Object.keys(this.state)
|
||||||
|
.filter(key => {
|
||||||
|
return (
|
||||||
|
[
|
||||||
|
'group',
|
||||||
|
'filter',
|
||||||
|
'search',
|
||||||
|
'page',
|
||||||
|
'sort_by',
|
||||||
|
'sort_order'
|
||||||
|
].indexOf(key) !== -1
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.map(key => {
|
||||||
|
let value = this.state[key];
|
||||||
|
if (value === Object(value)) {
|
||||||
|
value = jQuery.param(value)
|
||||||
|
} else if (value === Boolean(value)) {
|
||||||
|
value = value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== '' && value !== null) {
|
||||||
|
return `${key}[${value}]`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(key => { return (key !== undefined) })
|
||||||
|
.join('/');
|
||||||
|
|
||||||
|
// prepend url with "tab" if specified
|
||||||
|
if (this.props.tab !== undefined) {
|
||||||
|
params = `/${ this.props.tab }/${ params }`;
|
||||||
|
} else {
|
||||||
|
params = `/${ params }`;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.location.pathname !== params) {
|
if (this.props.location.pathname !== params) {
|
||||||
this.context.router.push(`${params}`);
|
this.context.router.push(`${params}`);
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,11 @@ class SubscriberSegment extends Model {
|
|||||||
'segment_id', $wp_segment->id
|
'segment_id', $wp_segment->id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($segment_ids)) {
|
||||||
|
$subscriptions = $subscriptions->whereIn('segment_id', $segment_ids);
|
||||||
|
}
|
||||||
|
|
||||||
return $subscriptions->deleteMany();
|
return $subscriptions->deleteMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user