From 050815dd7ed608f843cdeccde69e277f0213a0dd Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 21 Mar 2022 13:00:10 +0100 Subject: [PATCH] Resolve #287 --- dev/Settings/User/Accounts.js | 2 +- dev/Stores/User/Identity.js | 2 -- plugins/demo-account/index.php | 2 +- plugins/demo-account/storage.php | 4 ++-- .../app/libraries/RainLoop/Actions/Accounts.php | 4 ++-- .../RainLoop/Providers/Storage/FileStorage.php | 12 +++++------- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/dev/Settings/User/Accounts.js b/dev/Settings/User/Accounts.js index b7baa37da..014d0be73 100644 --- a/dev/Settings/User/Accounts.js +++ b/dev/Settings/User/Accounts.js @@ -87,7 +87,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ { accountsAndIdentitiesAfterMove() { Remote.request('AccountsAndIdentitiesSortOrder', null, { Accounts: AccountUserStore.getEmailAddresses().filter(v => v != SettingsGet('MainEmail')), - Identities: IdentityUserStore.getIDS() + Identities: IdentityUserStore.map(item => (item ? item.id() : "")) }); } diff --git a/dev/Stores/User/Identity.js b/dev/Stores/User/Identity.js index cc4794718..224ae2226 100644 --- a/dev/Stores/User/Identity.js +++ b/dev/Stores/User/Identity.js @@ -2,6 +2,4 @@ import { koArrayWithDestroy } from 'External/ko'; export const IdentityUserStore = koArrayWithDestroy(); -IdentityUserStore.getIDS = () => IdentityUserStore.map(item => (item ? item.id() : null)) - .filter(value => null !== value); IdentityUserStore.loading = ko.observable(false).extend({ debounce: 100 }); diff --git a/plugins/demo-account/index.php b/plugins/demo-account/index.php index 1a08e9ff3..b9ad74d1d 100644 --- a/plugins/demo-account/index.php +++ b/plugins/demo-account/index.php @@ -5,7 +5,7 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin const NAME = 'Demo Account Extension', CATEGORY = 'Login', - REQUIRED = '2.10.1', + REQUIRED = '2.14.0', DESCRIPTION = 'Extension to enable a demo account'; /** diff --git a/plugins/demo-account/storage.php b/plugins/demo-account/storage.php index 5ad34dc88..89d7be7f7 100644 --- a/plugins/demo-account/storage.php +++ b/plugins/demo-account/storage.php @@ -9,7 +9,7 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage /** * @param \RainLoop\Model\Account|string|null $mAccount */ - public function GenerateFilePath($mAccount, int $iStorageType, bool $bMkDir = false, bool $bForDeleteAction = false) : string + public function GenerateFilePath($mAccount, int $iStorageType, bool $bMkDir = false) : string { $sEmail = ''; if ($mAccount instanceof \RainLoop\Model\MainAccount) { @@ -18,7 +18,7 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage $sEmail = $mAccount; } if ($sEmail != $this->sDemoEmail) { - return parent::GenerateFilePath($mAccount, $iStorageType, $bMkDir, $bForDeleteAction); + return parent::GenerateFilePath($mAccount, $iStorageType, $bMkDir); } $sDataPath = "{$this->sDataPath}/demo"; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php index f0369d2a5..c0031fc6d 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Accounts.php @@ -225,7 +225,7 @@ trait Accounts } return $this->DefaultResponse(__FUNCTION__, $this->StorageProvider()->Put( - $this->getMainAccountFromToken(), + $this->getAccountFromToken(), StorageType::CONFIG, 'identities_order', \json_encode(array( @@ -280,7 +280,7 @@ trait Accounts if ($old) { $this->StorageProvider()->Put( - $this->getMainAccountFromToken(), + $oAccount, StorageType::CONFIG, 'identities_order', \json_encode(array('Identities' => empty($order['Identities']) ? [] : $order['Identities'])) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php index d5e037a86..e31e03f9f 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php @@ -77,7 +77,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage */ public function DeleteStorage($mAccount) : bool { - $sPath = $this->generateFileName($mAccount, StorageType::CONFIG, '', false, true); + $sPath = $this->generateFileName($mAccount, StorageType::CONFIG, ''); if ($sPath && \is_dir($sPath)) { \MailSo\Base\Utils::RecRmDir($sPath); } @@ -89,7 +89,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage return $this->bLocal; } - public function GenerateFilePath($mAccount, int $iStorageType, bool $bMkDir = false, bool $bForDeleteAction = false) : string + public function GenerateFilePath($mAccount, int $iStorageType, bool $bMkDir = false) : string { $sEmail = $sSubFolder = ''; if (null === $mAccount) { @@ -98,9 +98,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage $sEmail = $mAccount->Email(); } else if ($mAccount instanceof \RainLoop\Model\AdditionalAccount) { $sEmail = $mAccount->ParentEmail(); - if ($this->bLocal && !$bForDeleteAction) { - $sSubFolder = $mAccount->Email(); - } + $sSubFolder = $mAccount->Email(); } else if (\is_string($mAccount)) { $sEmail = $mAccount; } @@ -153,9 +151,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage /** * @param \RainLoop\Model\Account|string|null $mAccount */ - protected function generateFileName($mAccount, int $iStorageType, string $sKey, bool $bMkDir = false, bool $bForDeleteAction = false) : string + protected function generateFileName($mAccount, int $iStorageType, string $sKey, bool $bMkDir = false) : string { - $sFilePath = $this->GenerateFilePath($mAccount, $iStorageType, $bMkDir, $bForDeleteAction); + $sFilePath = $this->GenerateFilePath($mAccount, $iStorageType, $bMkDir); if ($sFilePath) { if (StorageType::NOBODY === $iStorageType) { $sFilePath .= \sha1($sKey ?: \time());