This commit is contained in:
the-djmaze 2022-03-21 13:00:10 +01:00
parent 443c3c199e
commit 050815dd7e
6 changed files with 11 additions and 15 deletions

View file

@ -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() : ""))
});
}

View file

@ -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 });

View file

@ -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';
/**

View file

@ -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";

View file

@ -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']))

View file

@ -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());