From 962ddde1f3908191f32d48f36867095ca5208673 Mon Sep 17 00:00:00 2001
From: the-djmaze <>
Date: Thu, 24 Feb 2022 12:43:44 +0100
Subject: [PATCH] Some small cleanups and fixes
---
build/plugins.php | 2 +-
dev/Common/Links.js | 6 +--
dev/Common/Utils.js | 2 +-
dev/Common/UtilsUser.js | 1 +
dev/Stores/User/Messagelist.js | 1 +
dev/View/Popup/Domain.js | 42 +++++++++----------
.../libraries/RainLoop/Providers/Settings.php | 4 +-
.../0.0.0/app/libraries/RainLoop/Settings.php | 9 +---
.../templates/Views/Admin/PopupsDomain.html | 6 +--
9 files changed, 34 insertions(+), 39 deletions(-)
diff --git a/build/plugins.php b/build/plugins.php
index cef6a4e12..e2c5d3507 100755
--- a/build/plugins.php
+++ b/build/plugins.php
@@ -1,6 +1,6 @@
Settings.app('webVersionPath') || 'snappymail/v/' + VERSION + '/',
adminPath = () => rl.adminArea() && !Settings.app('adminHostUse'),
@@ -75,14 +75,14 @@ export const
* @param {string} path
* @returns {string}
*/
- staticLink = path => VERSION_PREFIX + 'static/' + path,
+ staticLink = path => VERSION_PREFIX() + 'static/' + path,
/**
* @param {string} theme
* @returns {string}
*/
themePreviewLink = theme => {
- let prefix = VERSION_PREFIX;
+ let prefix = VERSION_PREFIX();
if ('@custom' === theme.slice(-7)) {
theme = theme.slice(0, theme.length - 7).trim();
prefix = Settings.app('webPath') || '';
diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js
index a7f07c579..585b2edc1 100644
--- a/dev/Common/Utils.js
+++ b/dev/Common/Utils.js
@@ -44,7 +44,7 @@ export const
/* // Without deprecated 'unescape':
b64EncodeJSON = data => btoa(encodeURIComponent(JSON.stringify(data)).replace(
/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode('0x' + p1)
- )),
+ )),
*/
b64EncodeJSONSafe = data => b64EncodeJSON(data).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''),
diff --git a/dev/Common/UtilsUser.js b/dev/Common/UtilsUser.js
index e3b8ff9eb..d1bda2777 100644
--- a/dev/Common/UtilsUser.js
+++ b/dev/Common/UtilsUser.js
@@ -1,4 +1,5 @@
import { MessageFlagsCache, addRequestedMessage } from 'Common/Cache';
+import { Notification } from 'Common/Enums';
import { MessageSetAction, ComposeType/*, FolderType*/ } from 'Common/EnumsUser';
import { doc, createElement, elementById } from 'Common/Globals';
import { plainToHtml } from 'Common/Html';
diff --git a/dev/Stores/User/Messagelist.js b/dev/Stores/User/Messagelist.js
index ed3bc11e6..7b3116b74 100644
--- a/dev/Stores/User/Messagelist.js
+++ b/dev/Stores/User/Messagelist.js
@@ -1,5 +1,6 @@
import { koComputable } from 'External/ko';
+import { Notification } from 'Common/Enums';
import { MessageSetAction } from 'Common/EnumsUser';
import { $htmlCL } from 'Common/Globals';
import { arrayLength, pInt, pString } from 'Common/Utils';
diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js
index 0c7bb48fb..455fd2c2f 100644
--- a/dev/View/Popup/Domain.js
+++ b/dev/View/Popup/Domain.js
@@ -11,16 +11,16 @@ import { DomainAdminStore } from 'Stores/Admin/Domain';
const domainToParams = oDomain => ({
Name: oDomain.name(),
- IncHost: oDomain.imapServer(),
+ IncHost: oDomain.imapHost(),
IncPort: oDomain.imapPort(),
IncSecure: oDomain.imapSecure(),
UseSieve: oDomain.useSieve() ? 1 : 0,
- SieveHost: oDomain.sieveServer(),
+ SieveHost: oDomain.sieveHost(),
SievePort: oDomain.sievePort(),
SieveSecure: oDomain.sieveSecure(),
- OutHost: oDomain.smtpServer(),
+ OutHost: oDomain.smtpHost(),
OutPort: oDomain.smtpPort(),
OutSecure: oDomain.smtpSecure(),
OutAuth: oDomain.smtpAuth() ? 1 : 0,
@@ -46,9 +46,9 @@ class DomainPopupView extends AbstractViewPopup {
testingSieveErrorDesc: '',
testingSmtpErrorDesc: '',
- imapServerFocus: false,
- sieveServerFocus: false,
- smtpServerFocus: false,
+ imapHostFocus: false,
+ sieveHostFocus: false,
+ smtpHostFocus: false,
});
this.addComputables({
@@ -83,10 +83,10 @@ class DomainPopupView extends AbstractViewPopup {
return (
this.name() &&
- this.imapServer() &&
+ this.imapHost() &&
this.imapPort() &&
- (useSieve ? this.sieveServer() && this.sievePort() : true) &&
- ((this.smtpServer() && this.smtpPort()) || usePhpMail)
+ (useSieve ? this.sieveHost() && this.sievePort() : true) &&
+ ((this.smtpHost() && this.smtpPort()) || usePhpMail)
);
},
@@ -100,14 +100,14 @@ class DomainPopupView extends AbstractViewPopup {
testingSmtpError: value => value || this.testingSmtpErrorDesc(''),
// smart form improvements
- imapServerFocus: value =>
- value && this.name() && !this.imapServer() && this.imapServer(this.name().replace(/[.]?[*][.]?/g, '')),
+ imapHostFocus: value =>
+ value && this.name() && !this.imapHost() && this.imapHost(this.name().replace(/[.]?[*][.]?/g, '')),
- sieveServerFocus: value =>
- value && this.imapServer() && !this.sieveServer() && this.sieveServer(this.imapServer()),
+ sieveHostFocus: value =>
+ value && this.imapHost() && !this.sieveHost() && this.sieveHost(this.imapHost()),
- smtpServerFocus: value => value && this.imapServer() && !this.smtpServer()
- && this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp')),
+ smtpHostFocus: value => value && this.imapHost() && !this.smtpHost()
+ && this.smtpHost(this.imapHost().replace(/imap/gi, 'smtp')),
imapSecure: value => {
if (this.enableSmartPorts()) {
@@ -247,15 +247,15 @@ class DomainPopupView extends AbstractViewPopup {
this.edit(true);
this.name(oDomain.Name);
- this.imapServer(oDomain.IncHost);
+ this.imapHost(oDomain.IncHost);
this.imapPort('' + pInt(oDomain.IncPort));
this.imapSecure(oDomain.IncSecure);
this.imapShortLogin(!!oDomain.IncShortLogin);
this.useSieve(!!oDomain.UseSieve);
- this.sieveServer(oDomain.SieveHost);
+ this.sieveHost(oDomain.SieveHost);
this.sievePort('' + pInt(oDomain.SievePort));
this.sieveSecure(oDomain.SieveSecure);
- this.smtpServer(oDomain.OutHost);
+ this.smtpHost(oDomain.OutHost);
this.smtpPort('' + pInt(oDomain.OutPort));
this.smtpSecure(oDomain.OutSecure);
this.smtpShortLogin(!!oDomain.OutShortLogin);
@@ -275,17 +275,17 @@ class DomainPopupView extends AbstractViewPopup {
name: '',
- imapServer: '',
+ imapHost: '',
imapPort: '143',
imapSecure: 0,
imapShortLogin: false,
useSieve: false,
- sieveServer: '',
+ sieveHost: '',
sievePort: '4190',
sieveSecure: 0,
- smtpServer: '',
+ smtpHost: '',
smtpPort: '25',
smtpSecure: 0,
smtpShortLogin: false,
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php
index 5b32f8af8..d913b36da 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php
@@ -16,9 +16,7 @@ class Settings extends \RainLoop\Providers\AbstractProvider
public function Load(\RainLoop\Model\Account $oAccount) : \RainLoop\Settings
{
- $oSettings = new \RainLoop\Settings();
- $oSettings->InitData($this->oDriver->Load($oAccount));
- return $oSettings;
+ return new \RainLoop\Settings($this->oDriver->Load($oAccount));
}
public function Save(\RainLoop\Model\Account $oAccount, \RainLoop\Settings $oSettings) : bool
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Settings.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Settings.php
index a2067b60d..f1e8c4683 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Settings.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Settings.php
@@ -7,14 +7,9 @@ class Settings
/**
* @var array
*/
- protected $aData;
+ protected $aData = array();
- public function __construct()
- {
- $this->aData = array();
- }
-
- public function InitData(array $aData) : void
+ public function __construct(array $aData)
{
$this->aData = $aData;
}
diff --git a/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html b/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html
index f8f9be76a..a53dedda5 100644
--- a/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html
+++ b/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html
@@ -29,7 +29,7 @@
+ data-bind="textInput: imapHost, hasfocus: imapHostFocus">