Bugfix: compose/send mail AdditionalAccount failed

This commit is contained in:
djmaze 2021-11-15 14:55:49 +01:00
parent 8a351e5763
commit 5f4c7c5c5b
5 changed files with 35 additions and 30 deletions

View file

@ -97,15 +97,19 @@
}
.e-identity {
color: var(--main-color);
text-decoration: none;
font-weight: bold;
line-height: @baseLineHeight;
padding: 4px 0;
text-decoration: none;
&.multiply {
cursor: pointer;
border-bottom: 1px dashed var(--main-color);
}
&.multiply::after {
content: '▼';
}
}
> div {

View file

@ -1111,19 +1111,6 @@ class Actions
);
}
public function GetIdentityByID(Model\Account $oAccount, string $sID, bool $bFirstOnEmpty = false): ?Model\Identity
{
$aIdentities = $this->GetIdentities($oAccount);
foreach ($aIdentities as $oIdentity) {
if ($oIdentity && $sID === $oIdentity->Id()) {
return $oIdentity;
}
}
return $bFirstOnEmpty && isset($aIdentities[0]) ? $aIdentities[0] : null;
}
public function setConfigFromParams(Config\Application $oConfig, string $sParamName, string $sConfigSector, string $sConfigName, string $sType = 'string', ?callable $mStringCallback = null): void
{
$sValue = $this->GetActionParam($sParamName, '');

View file

@ -224,21 +224,19 @@ trait Accounts
*/
public function DoAccountsAndIdentities(): array
{
$oAccount = $this->getMainAccountFromToken();
return $this->DefaultResponse(__FUNCTION__, array(
'Accounts' => \array_map(
'MailSo\\Base\\Utils::IdnToUtf8',
\array_keys($this->GetAccounts($oAccount))
\array_keys($this->GetAccounts($this->getMainAccountFromToken()))
),
'Identities' => $this->GetIdentities($oAccount)
'Identities' => $this->GetIdentities($this->getAccountFromToken())
));
}
/**
* @return Identity[]
*/
public function GetIdentities(MainAccount $oAccount): array
public function GetIdentities(Account $oAccount): array
{
// A custom name for a single identity is also stored in this system
$allowMultipleIdentities = $this->GetCapa(false, Capa::IDENTITIES, $oAccount);
@ -281,4 +279,17 @@ trait Accounts
return $identities;
}
public function GetIdentityByID(Account $oAccount, string $sID, bool $bFirstOnEmpty = false): ?Identity
{
$aIdentities = $this->GetIdentities($oAccount);
foreach ($aIdentities as $oIdentity) {
if ($oIdentity && $sID === $oIdentity->Id()) {
return $oIdentity;
}
}
return $bFirstOnEmpty && isset($aIdentities[0]) ? $aIdentities[0] : null;
}
}

View file

@ -22,19 +22,22 @@
<tr>
<td data-i18n="GLOBAL/FROM"></td>
<td>
<!-- ko if: 1 < identitiesOptions().length -->
<div class="dropdown" style="display:inline-block" data-bind="registerBootstrapDropdown: true, openDropdownTrigger: identitiesDropdownTrigger">
<a class="dropdown-toggle e-identity" href="#" tabindex="-1"
<a class="dropdown-toggle e-identity multiply" href="#" tabindex="-1"
id="identity-label-id" role="button"
data-bind="text: currentIdentityView, css: {'multiply': 1 < identitiesOptions().length }">
data-bind="text: currentIdentityView">
</a>
<!-- ko if: 1 < identitiesOptions().length -->
<ul class="dropdown-menu" role="menu" aria-labelledby="identity-label-id" data-bind="foreach: identitiesOptions">
<li role="presentation">
<a tabindex="-1" href="#" data-bind="click: function (oIdentity) { $root.selectIdentity(oIdentity); return true; }, text: optText"></a>
</li>
</ul>
<!-- /ko -->
<ul class="dropdown-menu" role="menu" aria-labelledby="identity-label-id" data-bind="foreach: identitiesOptions">
<li role="presentation">
<a tabindex="-1" href="#" data-bind="click: function (oIdentity) { $root.selectIdentity(oIdentity); return true; }, text: optText"></a>
</li>
</ul>
</div>
<!-- /ko -->
<!-- ko if: 2 > identitiesOptions().length -->
<span class="e-identity" data-bind="text: currentIdentityView"></span>
<!-- /ko -->
<div class="pull-right">
<a class="btn" data-i18n="GLOBAL/BCC"
data-bind="visible: !showBcc(), click: function () { showBcc(true); }"></a>

View file

@ -55,7 +55,7 @@
// Links within the dropdown menu
a {
background-color: var(--dropdown-menu-bg-color, #fff);
color: var(--main-color, @dropdownLinkColor);
color: var(--dropdown-menu-color, @dropdownLinkColor);
display: block;
padding: 3px 10px;
text-decoration: none;