Update User\Model
Change the algorithm for calculating the email_normal property
This commit is contained in:
parent
79d068e8f0
commit
a29d6c1f16
2 changed files with 13 additions and 23 deletions
|
@ -59,8 +59,6 @@ class Model extends DataModel
|
|||
} elseif (1 === $this->poster_id) {
|
||||
$user = clone $user;
|
||||
|
||||
$user->setAttr('email_normal', false); // заблокировать вычисление в модели User
|
||||
|
||||
$user->__email = $this->poster_email;
|
||||
$user->__username = $this->poster;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,6 @@ use function \ForkBB\__;
|
|||
|
||||
class Model extends DataModel
|
||||
{
|
||||
/**
|
||||
* Типы аватарок
|
||||
* @var array
|
||||
*/
|
||||
protected $avatarTypes = ['jpg', 'gif', 'png'];
|
||||
|
||||
public function __construct(Container $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
|
@ -31,6 +25,7 @@ class Model extends DataModel
|
|||
'show_sig' => ['showSignature'],
|
||||
'show_avatars' => ['showAvatar'],
|
||||
'signature' => ['isSignature'],
|
||||
'email' => ['email_normal'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -346,25 +341,22 @@ class Model extends DataModel
|
|||
}
|
||||
|
||||
/**
|
||||
* Установка email и вычисление нормализованного email
|
||||
* Вычисление нормализованного email
|
||||
*/
|
||||
protected function setemail(string $email): void
|
||||
protected function getemail_normal(): string
|
||||
{
|
||||
$this->setAttr('email', $email);
|
||||
return $this->c->NormEmail->normalize($this->email);
|
||||
}
|
||||
|
||||
if (
|
||||
empty($email)
|
||||
|| false === $this->getAttr('email_normal')
|
||||
) {
|
||||
return;
|
||||
/**
|
||||
* Возвращает значения свойств в массиве
|
||||
*/
|
||||
public function getAttrs(): array
|
||||
{
|
||||
if (isset($this->zModFlags['email_normal'])) {
|
||||
$this->setAttr('email_normal', $this->email_normal);
|
||||
}
|
||||
|
||||
$nEmail = $this->c->NormEmail->normalize($email);
|
||||
|
||||
if (isset($this->zTrackFlags['email'])) {
|
||||
$this->email_normal = $nEmail;
|
||||
} else {
|
||||
$this->__email_normal = $nEmail; // ???? $this->setAttr('email_normal', $nEmail);
|
||||
}
|
||||
return parent::getAttrs();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue