diff --git a/Gruntfile.js b/Gruntfile.js index 3c60c20a9..2ae37c69d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -263,8 +263,8 @@ module.exports = function (grunt) { "dev/ViewModels/SettingsPaneViewModel.js", "dev/Settings/General.js", - "dev/Settings/Personal.js", "dev/Settings/Accounts.js", + "dev/Settings/Identity.js", "dev/Settings/Identities.js", "dev/Settings/Social.js", "dev/Settings/ChangePassword.js", diff --git a/dev/Boots/RainLoopApp.js b/dev/Boots/RainLoopApp.js index 01d820252..5139d07f4 100644 --- a/dev/Boots/RainLoopApp.js +++ b/dev/Boots/RainLoopApp.js @@ -579,7 +579,7 @@ RainLoopApp.prototype.bootstart = function () if (this.settingsGet('AllowIdentities')) { - Utils.removeSettingsViewModel(SettingsPersonal); + Utils.removeSettingsViewModel(SettingsIdentity); } else { diff --git a/dev/Settings/Identities.js b/dev/Settings/Identities.js index 2f89a3d71..40eebdfb6 100644 --- a/dev/Settings/Identities.js +++ b/dev/Settings/Identities.js @@ -7,12 +7,16 @@ function SettingsIdentities() { var oData = RL.data(); + this.displayName = oData.displayName; + this.signature = oData.signature; + this.replyTo = oData.replyTo; + + this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); + this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle); + this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle); + this.identities = oData.identities; - this.legent = ko.computed(function () { - return Utils.i18n('SETTINGS_IDENTITIES/LEGEND_IDENTITIES_FOR', {'EMAIL': oData.accountEmail()}); - }, this); - this.processText = ko.computed(function () { return oData.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : ''; }, this); @@ -34,9 +38,6 @@ function SettingsIdentities() } } ]}); - - this.signature = oData.signature; - this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle); } Utils.addSettingsViewModel(SettingsIdentities, 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities'); @@ -52,7 +53,6 @@ SettingsIdentities.prototype.editIdentity = function (oIdentity) }; /** - * * @param {IdentityModel} oIdentityToRemove */ SettingsIdentities.prototype.deleteIdentity = function (oIdentityToRemove) @@ -96,11 +96,25 @@ SettingsIdentities.prototype.onBuild = function (oDom) var oData = RL.data(), - f1 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self) + f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self), + f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self), + f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self) ; - oData.signature.subscribe(function (sValue) { + oData.displayName.subscribe(function (sValue) { RL.remote().saveSettings(f1, { + 'DisplayName': sValue + }); + }); + + oData.replyTo.subscribe(function (sValue) { + RL.remote().saveSettings(f2, { + 'ReplyTo': sValue + }); + }); + + oData.signature.subscribe(function (sValue) { + RL.remote().saveSettings(f3, { 'Signature': sValue }); }); diff --git a/dev/Settings/Personal.js b/dev/Settings/Identity.js similarity index 73% rename from dev/Settings/Personal.js rename to dev/Settings/Identity.js index 3cd18dc91..586d70ede 100644 --- a/dev/Settings/Personal.js +++ b/dev/Settings/Identity.js @@ -3,29 +3,29 @@ /** * @constructor */ -function SettingsPersonal() +function SettingsIdentity() { var oData = RL.data(); this.displayName = oData.displayName; - this.replyTo = oData.replyTo; this.signature = oData.signature; + this.replyTo = oData.replyTo; - this.nameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); + this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle); } -Utils.addSettingsViewModel(SettingsPersonal, 'SettingsPersonal', 'SETTINGS_LABELS/LABEL_PERSONAL_NAME', 'personal'); +Utils.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity'); -SettingsPersonal.prototype.onBuild = function () +SettingsIdentity.prototype.onBuild = function () { var self = this; _.delay(function () { var oData = RL.data(), - f1 = Utils.settingsSaveHelperSimpleFunction(self.nameTrigger, self), + f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self), f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self), f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self) ; diff --git a/dev/Styles/@Main.less b/dev/Styles/@Main.less index 26214f131..62971b84f 100644 --- a/dev/Styles/@Main.less +++ b/dev/Styles/@Main.less @@ -61,9 +61,9 @@ @import "AdminPlugin.less"; @import "Activate.less"; @import "Settings.less"; -@import "SettingsPersonal.less"; @import "SettingsGeneral.less"; @import "SettingsAccounts.less"; +@import "SettingsIdentity.less"; @import "SettingsIdentities.less"; @import "SettingsFolders.less"; @import "SettingsThemes.less"; diff --git a/dev/Styles/SettingsIdentity.less b/dev/Styles/SettingsIdentity.less new file mode 100644 index 000000000..4791de8e2 --- /dev/null +++ b/dev/Styles/SettingsIdentity.less @@ -0,0 +1,4 @@ + +.b-settings-identity { + +} diff --git a/dev/Styles/SettingsPersonal.less b/dev/Styles/SettingsPersonal.less deleted file mode 100644 index e234ffda2..000000000 --- a/dev/Styles/SettingsPersonal.less +++ /dev/null @@ -1,4 +0,0 @@ - -.b-settings-personal { - -} diff --git a/dev/ViewModels/PopupsComposeViewModel.js b/dev/ViewModels/PopupsComposeViewModel.js index cb91983f3..bed75d4e7 100644 --- a/dev/ViewModels/PopupsComposeViewModel.js +++ b/dev/ViewModels/PopupsComposeViewModel.js @@ -19,6 +19,7 @@ function PopupsComposeViewModel() var self = this, + oRainLoopData = RL.data(), fEmailArrayToStringLineHelper = function (aList) { var @@ -112,12 +113,21 @@ function PopupsComposeViewModel() this.currentIdentityResultEmail = ko.observable(''); this.identitiesOptions = ko.computed(function () { - return _.map(RL.data().identities(), function (oItem) { - return { + + var aList = [{ + 'optValue': oRainLoopData.accountEmail(), + 'optText': this.formattedFrom(false) + }]; + + _.each(oRainLoopData.identities(), function (oItem) { + aList.push({ 'optValue': oItem.id, 'optText': oItem.formattedNameForCompose() - }; + }); }); + + return aList; + }, this); ko.computed(function () { @@ -130,7 +140,7 @@ function PopupsComposeViewModel() sID = this.currentIdentityID() ; - if (this.bAllowIdentities && sID) + if (this.bAllowIdentities && sID && sID !== RL.data().accountEmail()) { oItem = _.find(aList, function (oItem) { return oItem && sID === oItem['id']; @@ -142,9 +152,11 @@ function PopupsComposeViewModel() if ('' === sResult && aList[0]) { this.currentIdentityID(aList[0]['id']); + return ''; } } - else + + if ('' === sResult) { sResult = this.formattedFrom(false); sResultEmail = this.formattedFrom(true); @@ -427,10 +439,8 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp oIDs[oItem.email()] = oItem['id']; }); } - else - { - oIDs[RL.data().accountEmail()] = RL.data().accountEmail(); - } + + oIDs[RL.data().accountEmail()] = RL.data().accountEmail(); switch (sComposeType) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 0f97d6f2f..260567045 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -1330,7 +1330,8 @@ class Actions { foreach ($aSubIdentities as $aItem) { - if (isset($aItem['Id'], $aItem['Email'], $aItem['Name'], $aItem['ReplyTo'], $aItem['Bcc'])) + if (isset($aItem['Id'], $aItem['Email'], $aItem['Name'], $aItem['ReplyTo'], $aItem['Bcc']) && + $aItem['Id'] !== $oAccount->Email()) { $oItem = \RainLoop\Identity::NewInstance($aItem['Id'], $aItem['Email'], $aItem['Name'], $aItem['ReplyTo'], $aItem['Bcc']); @@ -1339,14 +1340,6 @@ class Actions } } } - - if (0 === \count($aIdentities)) - { - $aIdentities[] = \RainLoop\Identity::NewInstance($oAccount->Email(), $oAccount->Email(), - $oSettings->GetConf('DisplayName', ''), - $oSettings->GetConf('ReplyTo', '') - ); - } } return $aIdentities; @@ -1514,20 +1507,6 @@ class Actions $sReplyTo = \trim($this->GetActionParam('ReplyTo', '')); $sBcc = \trim($this->GetActionParam('Bcc', '')); - if ($sId === $oAccount->Email()) - { - $sEmail = $oAccount->Email(); - - $oSettings = $this->SettingsProvider()->Load($oAccount); - if ($oSettings) - { - $oSettings->SetConf('DisplayName', $sName); - $oSettings->SetConf('ReplyTo', $sReplyTo); - - $this->SettingsProvider()->Save($oAccount, $oSettings); - } - } - if (empty($sEmail)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError); @@ -1583,7 +1562,7 @@ class Actions $oAccount = $this->getAccountFromToken(); $sId = \trim($this->GetActionParam('IdToDelete', '')); - if (empty($sId) || $sId === $oAccount->Email()) + if (empty($sId)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError); } diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html index 2cee5daee..8df69a67f 100644 --- a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html @@ -84,7 +84,7 @@ diff --git a/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html index d342f12de..c02396f7b 100644 --- a/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html +++ b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html @@ -1,7 +1,39 @@
- + +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
@@ -39,15 +71,4 @@ -
-
-
-
- -
-
-
- -
-
\ No newline at end of file diff --git a/rainloop/v/0.0.0/app/templates/Views/SettingsPersonal.html b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html similarity index 68% rename from rainloop/v/0.0.0/app/templates/Views/SettingsPersonal.html rename to rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html index 2e4f8f7b8..6c47d38c0 100644 --- a/rainloop/v/0.0.0/app/templates/Views/SettingsPersonal.html +++ b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html @@ -1,20 +1,20 @@ -
+
- +
- -
+ +