From 2ab17f8eff7abeff4925e0394fd5cf1556cf68a4 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 29 Oct 2015 23:47:23 +0300 Subject: [PATCH] Small refactoring: Identity --- dev/Model/Identity.js | 2 +- dev/View/Popup/Identity.js | 2 +- .../v/0.0.0/app/libraries/RainLoop/Model/Identity.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/Model/Identity.js b/dev/Model/Identity.js index d28c201a3..d657fee64 100644 --- a/dev/Model/Identity.js +++ b/dev/Model/Identity.js @@ -19,7 +19,7 @@ { AbstractModel.call(this, 'IdentityModel'); - this.id = ko.observable(sId); + this.id = ko.observable(sId || ''); this.email = ko.observable(sEmail); this.name = ko.observable(''); diff --git a/dev/View/Popup/Identity.js b/dev/View/Popup/Identity.js index 92c931230..d388f373a 100644 --- a/dev/View/Popup/Identity.js +++ b/dev/View/Popup/Identity.js @@ -170,7 +170,7 @@ { this.edit(true); - this.id = oIdentity.id(); + this.id = oIdentity.id() || ''; this.name(oIdentity.name()); this.email(oIdentity.email()); this.replyTo(oIdentity.replyTo()); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Identity.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Identity.php index 1923ce66e..bdd9c8403 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Identity.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Identity.php @@ -47,8 +47,8 @@ class Identity */ protected function __construct($sId = '', $sEmail = '') { - $this->sId = $sId; - $this->sEmail = $sEmail; + $this->sId = empty($sId) ? '' : $sId; + $this->sEmail = empty($sEmail) ? '' : $sEmail; $this->sName = ''; $this->sReplyTo = ''; $this->sBcc = ''; @@ -152,9 +152,9 @@ class Identity */ public function FromJSON($aData, $bAjax = false) { - if (isset($aData['Id'], $aData['Email']) && !empty($aData['Email'])) + if (!empty($aData['Email'])) { - $this->sId = $aData['Id']; + $this->sId = !empty($aData['Id']) ? $aData['Id'] : ''; $this->sEmail = $bAjax ? \MailSo\Base\Utils::IdnToAscii($aData['Email'], true) : $aData['Email']; $this->sName = isset($aData['Name']) ? $aData['Name'] : ''; $this->sReplyTo = !empty($aData['ReplyTo']) ? $aData['ReplyTo'] : '';