Address PR review remarks [MAILPOET-1721]
This commit is contained in:
@ -108,7 +108,7 @@ const itemActions = [
|
||||
);
|
||||
},
|
||||
display: function display(segment) {
|
||||
return isWPUsersSegment(segment);
|
||||
return !isSpecialSegment(segment);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -144,10 +144,10 @@ class API {
|
||||
$found_segments_ids = array();
|
||||
foreach($found_segments as $segment) {
|
||||
if($segment->type === Segment::TYPE_WP_USERS) {
|
||||
throw new \Exception(__(sprintf("Can't subscribe to a WordPress Users list with ID %d.", $segment->id), 'mailpoet'));
|
||||
throw new \Exception(__(sprintf("Can't unsubscribe from a WordPress Users list with ID %d.", $segment->id), 'mailpoet'));
|
||||
}
|
||||
if($segment->type === Segment::TYPE_WC_USERS) {
|
||||
throw new \Exception(__(sprintf("Can't subscribe to a WooCommerce Customers list with ID %d.", $segment->id), 'mailpoet'));
|
||||
throw new \Exception(__(sprintf("Can't unsubscribe from a WooCommerce Customers list with ID %d.", $segment->id), 'mailpoet'));
|
||||
}
|
||||
$found_segments_ids[] = $segment->id;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class Subscriber extends Model {
|
||||
}
|
||||
|
||||
function isWooCommerceUser() {
|
||||
return $this->is_woocommerce_user == true;
|
||||
return (bool)$this->is_woocommerce_user;
|
||||
}
|
||||
|
||||
static function getCurrentWPUser() {
|
||||
|
@ -621,7 +621,7 @@ class APITest extends \MailPoetTest {
|
||||
$this->getApi()->unsubscribeFromLists($subscriber->id, array($segment->id));
|
||||
$this->fail('WP Users segment exception should have been thrown.');
|
||||
} catch(\Exception $e) {
|
||||
expect($e->getMessage())->equals("Can't subscribe to a WordPress Users list with ID {$segment->id}.");
|
||||
expect($e->getMessage())->equals("Can't unsubscribe from a WordPress Users list with ID {$segment->id}.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -639,7 +639,7 @@ class APITest extends \MailPoetTest {
|
||||
$this->getApi()->unsubscribeFromLists($subscriber->id, array($segment->id));
|
||||
$this->fail('WooCommerce Customers segment exception should have been thrown.');
|
||||
} catch(\Exception $e) {
|
||||
expect($e->getMessage())->equals("Can't subscribe to a WooCommerce Customers list with ID {$segment->id}.");
|
||||
expect($e->getMessage())->equals("Can't unsubscribe from a WooCommerce Customers list with ID {$segment->id}.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user