Extract usage of emoji encoding from the newsletter model [MAILPOET-2460]

This commit is contained in:
wxa
2019-10-23 14:46:32 +03:00
committed by Jack Kitterhing
parent 8fb18e7c2e
commit da9c42963f
2 changed files with 12 additions and 6 deletions

View File

@@ -14,7 +14,6 @@ use MailPoet\Tasks\Sending as SendingTask;
use MailPoet\Util\Helpers;
use MailPoet\Util\Security;
use MailPoet\WooCommerce\Helper as WCHelper;
use MailPoet\WP\Emoji;
use MailPoet\WP\Functions as WPFunctions;
use function MailPoet\Util\array_column;
@@ -58,14 +57,11 @@ class Newsletter extends Model {
// automatic newsletters status
const STATUS_ACTIVE = NewsletterEntity::STATUS_ACTIVE;
private $emoji;
function __construct() {
parent::__construct();
$this->addValidations('type', [
'required' => WPFunctions::get()->__('Please specify a type.', 'mailpoet'),
]);
$this->emoji = new Emoji();
}
function queue() {
@@ -125,7 +121,7 @@ class Newsletter extends Model {
}
$this->set(
'body',
$this->emoji->encodeForUTF8Column(self::$_table, 'body', $this->body)
$this->body
);
}