mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Resolve #287
This commit is contained in:
parent
443c3c199e
commit
050815dd7e
6 changed files with 11 additions and 15 deletions
|
|
@ -87,7 +87,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
|
||||||
accountsAndIdentitiesAfterMove() {
|
accountsAndIdentitiesAfterMove() {
|
||||||
Remote.request('AccountsAndIdentitiesSortOrder', null, {
|
Remote.request('AccountsAndIdentitiesSortOrder', null, {
|
||||||
Accounts: AccountUserStore.getEmailAddresses().filter(v => v != SettingsGet('MainEmail')),
|
Accounts: AccountUserStore.getEmailAddresses().filter(v => v != SettingsGet('MainEmail')),
|
||||||
Identities: IdentityUserStore.getIDS()
|
Identities: IdentityUserStore.map(item => (item ? item.id() : ""))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,4 @@ import { koArrayWithDestroy } from 'External/ko';
|
||||||
|
|
||||||
export const IdentityUserStore = koArrayWithDestroy();
|
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 });
|
IdentityUserStore.loading = ko.observable(false).extend({ debounce: 100 });
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
const
|
const
|
||||||
NAME = 'Demo Account Extension',
|
NAME = 'Demo Account Extension',
|
||||||
CATEGORY = 'Login',
|
CATEGORY = 'Login',
|
||||||
REQUIRED = '2.10.1',
|
REQUIRED = '2.14.0',
|
||||||
DESCRIPTION = 'Extension to enable a demo account';
|
DESCRIPTION = 'Extension to enable a demo account';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Model\Account|string|null $mAccount
|
* @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 = '';
|
$sEmail = '';
|
||||||
if ($mAccount instanceof \RainLoop\Model\MainAccount) {
|
if ($mAccount instanceof \RainLoop\Model\MainAccount) {
|
||||||
|
|
@ -18,7 +18,7 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage
|
||||||
$sEmail = $mAccount;
|
$sEmail = $mAccount;
|
||||||
}
|
}
|
||||||
if ($sEmail != $this->sDemoEmail) {
|
if ($sEmail != $this->sDemoEmail) {
|
||||||
return parent::GenerateFilePath($mAccount, $iStorageType, $bMkDir, $bForDeleteAction);
|
return parent::GenerateFilePath($mAccount, $iStorageType, $bMkDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sDataPath = "{$this->sDataPath}/demo";
|
$sDataPath = "{$this->sDataPath}/demo";
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ trait Accounts
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->DefaultResponse(__FUNCTION__, $this->StorageProvider()->Put(
|
return $this->DefaultResponse(__FUNCTION__, $this->StorageProvider()->Put(
|
||||||
$this->getMainAccountFromToken(),
|
$this->getAccountFromToken(),
|
||||||
StorageType::CONFIG,
|
StorageType::CONFIG,
|
||||||
'identities_order',
|
'identities_order',
|
||||||
\json_encode(array(
|
\json_encode(array(
|
||||||
|
|
@ -280,7 +280,7 @@ trait Accounts
|
||||||
|
|
||||||
if ($old) {
|
if ($old) {
|
||||||
$this->StorageProvider()->Put(
|
$this->StorageProvider()->Put(
|
||||||
$this->getMainAccountFromToken(),
|
$oAccount,
|
||||||
StorageType::CONFIG,
|
StorageType::CONFIG,
|
||||||
'identities_order',
|
'identities_order',
|
||||||
\json_encode(array('Identities' => empty($order['Identities']) ? [] : $order['Identities']))
|
\json_encode(array('Identities' => empty($order['Identities']) ? [] : $order['Identities']))
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
||||||
*/
|
*/
|
||||||
public function DeleteStorage($mAccount) : bool
|
public function DeleteStorage($mAccount) : bool
|
||||||
{
|
{
|
||||||
$sPath = $this->generateFileName($mAccount, StorageType::CONFIG, '', false, true);
|
$sPath = $this->generateFileName($mAccount, StorageType::CONFIG, '');
|
||||||
if ($sPath && \is_dir($sPath)) {
|
if ($sPath && \is_dir($sPath)) {
|
||||||
\MailSo\Base\Utils::RecRmDir($sPath);
|
\MailSo\Base\Utils::RecRmDir($sPath);
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +89,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
||||||
return $this->bLocal;
|
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 = '';
|
$sEmail = $sSubFolder = '';
|
||||||
if (null === $mAccount) {
|
if (null === $mAccount) {
|
||||||
|
|
@ -98,9 +98,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
||||||
$sEmail = $mAccount->Email();
|
$sEmail = $mAccount->Email();
|
||||||
} else if ($mAccount instanceof \RainLoop\Model\AdditionalAccount) {
|
} else if ($mAccount instanceof \RainLoop\Model\AdditionalAccount) {
|
||||||
$sEmail = $mAccount->ParentEmail();
|
$sEmail = $mAccount->ParentEmail();
|
||||||
if ($this->bLocal && !$bForDeleteAction) {
|
$sSubFolder = $mAccount->Email();
|
||||||
$sSubFolder = $mAccount->Email();
|
|
||||||
}
|
|
||||||
} else if (\is_string($mAccount)) {
|
} else if (\is_string($mAccount)) {
|
||||||
$sEmail = $mAccount;
|
$sEmail = $mAccount;
|
||||||
}
|
}
|
||||||
|
|
@ -153,9 +151,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Model\Account|string|null $mAccount
|
* @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 ($sFilePath) {
|
||||||
if (StorageType::NOBODY === $iStorageType) {
|
if (StorageType::NOBODY === $iStorageType) {
|
||||||
$sFilePath .= \sha1($sKey ?: \time());
|
$sFilePath .= \sha1($sKey ?: \time());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue