Resolve #299 due to changes of #287

This commit is contained in:
the-djmaze 2022-03-22 15:36:10 +01:00
parent 13f270f426
commit 1833388ea4
3 changed files with 25 additions and 22 deletions

View file

@ -225,10 +225,12 @@ class Actions
APP_PRIVATE_DATA . 'storage', 'storage-local' === $sName);
break;
case 'settings':
// RainLoop\Providers\Settings\ISettings
$mResult = new Providers\Settings\DefaultSettings($this->StorageProvider());
break;
case 'settings-local':
// RainLoop\Providers\Settings\ISettings
$mResult = new Providers\Settings\DefaultSettings(
$this->StorageProvider('settings-local' === $sName));
$mResult = new Providers\Settings\DefaultSettings($this->LocalStorageProvider());
break;
case 'login':
// Providers\Login\LoginInterface
@ -267,7 +269,7 @@ class Actions
// Always give the file provider as last for identities, it is the override
if ('identities' === $sName) {
$mResult[] = new Providers\Identities\FileIdentities($this->StorageProvider(true));
$mResult[] = new Providers\Identities\FileIdentities($this->LocalStorageProvider());
}
foreach (\is_array($mResult) ? $mResult : array($mResult) as $oItem) {
@ -444,23 +446,22 @@ class Actions
return $this->oMailClient;
}
public function StorageProvider(bool $bLocal = false): Providers\Storage
// Stores data in AdditionalAccount else MainAccount
public function LocalStorageProvider(): Providers\Storage
{
if ($bLocal) {
if (!$this->oLocalStorageProvider) {
$this->oLocalStorageProvider = new Providers\Storage(
$this->fabrica('storage-local'));
}
return $this->oLocalStorageProvider;
} else {
if (!$this->oStorageProvider) {
$this->oStorageProvider = new Providers\Storage(
$this->fabrica('storage'));
}
return $this->oStorageProvider;
if (!$this->oLocalStorageProvider) {
$this->oLocalStorageProvider = new Providers\Storage($this->fabrica('storage-local'));
}
return $this->oLocalStorageProvider;
}
// Stores data in MainAccount
public function StorageProvider(): Providers\Storage
{
if (!$this->oStorageProvider) {
$this->oStorageProvider = new Providers\Storage($this->fabrica('storage'));
}
return $this->oStorageProvider;
}
public function SettingsProvider(bool $bLocal = false): Providers\Settings

View file

@ -224,7 +224,7 @@ trait Accounts
$this->SetAccounts($oAccount, $aAccounts);
}
return $this->DefaultResponse(__FUNCTION__, $this->StorageProvider()->Put(
return $this->DefaultResponse(__FUNCTION__, $this->LocalStorageProvider()->Put(
$this->getAccountFromToken(),
StorageType::CONFIG,
'identities_order',
@ -260,7 +260,7 @@ trait Accounts
$identities = $this->IdentitiesProvider()->GetIdentities($oAccount, $allowMultipleIdentities);
// Sort identities
$orderString = $this->StorageProvider()->Get($oAccount, StorageType::CONFIG, 'identities_order');
$orderString = $this->LocalStorageProvider()->Get($oAccount, StorageType::CONFIG, 'identities_order');
$old = false;
if (!$orderString) {
$orderString = $this->StorageProvider()->Get($oAccount, StorageType::CONFIG, 'accounts_identities_order');
@ -279,7 +279,7 @@ trait Accounts
}
if ($old) {
$this->StorageProvider()->Put(
$this->LocalStorageProvider()->Put(
$oAccount,
StorageType::CONFIG,
'identities_order',

View file

@ -98,7 +98,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
$sEmail = $mAccount->Email();
} else if ($mAccount instanceof \RainLoop\Model\AdditionalAccount) {
$sEmail = $mAccount->ParentEmail();
$sSubFolder = $mAccount->Email();
if ($this->bLocal) {
$sSubFolder = $mAccount->Email();
}
} else if (\is_string($mAccount)) {
$sEmail = $mAccount;
}