This commit is contained in:
the-djmaze 2022-02-15 10:22:52 +01:00
parent 93190f4071
commit e2c171f302
6 changed files with 94 additions and 100 deletions

View file

@ -34,6 +34,6 @@ export class IdentityModel extends AbstractModel {
const name = this.name(),
email = this.email();
return name ? name + ' (' + email + ')' : email;
return name ? name + ' <' + email + '>' : email;
}
}

View file

@ -55,12 +55,12 @@
background-color: rgba(0,0,0,0.8);
.close, .minimize-custom {
opacity: 1;
color: #fff;
border-color: #eee;
float: none;
font-size: 24px;
line-height: 24px;
opacity: 1;
line-height: 28px;
margin-left: .7em;
}
.btn.disabled {
@ -76,6 +76,10 @@
.disabled.button-delete {
margin-left: 0;
}
.pull-right * {
vertical-align: top;
}
}
.b-header {
@ -98,20 +102,13 @@
width: 4em;
}
.e-identity {
#identity-toggle {
color: var(--main-color);
font-weight: bold;
line-height: @baseLineHeight;
padding: 4px 0;
margin-left: 6px;
text-decoration: none;
&.multiply {
cursor: pointer;
border-bottom: 1px dashed var(--main-color);
}
&.multiply::after {
content: ' ▼';
}
}
#identity-toggle::after {
content: '▼';
}
textarea, input[type="text"] {
@ -170,12 +167,7 @@
border: 0 solid #333;
border-bottom-width: 3px;
display: inline-block;
float: right;
height: 20px;
width: 16px;
font-size: 20px;
font-weight: bold;
line-height: 20px;
margin-right: 15px;
cursor: pointer;
}

View file

@ -50,6 +50,13 @@ import { ThemeStore } from 'Stores/Theme';
const
base64_encode = text => btoa(text).match(/.{1,76}/g).join('\r\n'),
email = new EmailModel(),
getEmail = value => {
email.clear();
email.parse(value.trim());
return email.email || false;
},
/**
* @param {string} prefix
* @param {string} subject
@ -165,6 +172,7 @@ class ComposePopupView extends AbstractViewPopup {
this.addObservables({
identitiesDropdownTrigger: false,
from: '',
to: '',
cc: '',
bcc: '',
@ -214,9 +222,11 @@ class ComposePopupView extends AbstractViewPopup {
editorArea: null, // initDom
currentIdentity: IdentityUserStore()[0] || null
currentIdentity: IdentityUserStore()[0]
});
this.from(IdentityUserStore()[0].formattedName());
// this.to.subscribe((v) => console.log(v));
// Used by ko.bindingHandlers.emailsTags
@ -289,11 +299,6 @@ class ComposePopupView extends AbstractViewPopup {
optText: item.formattedName()
})),
currentIdentityView: () => {
const item = this.currentIdentity();
return item ? item.formattedName() : 'unknown';
},
canBeSentOrSaved: () => !this.sending() && !this.saving()
});
@ -304,11 +309,14 @@ class ComposePopupView extends AbstractViewPopup {
sendSuccessButSaveError: value => !value && this.savedErrorDesc(''),
currentIdentity: value => {
currentIdentity: value => value && this.from(value.formattedName()),
from: value => {
this.canPgpSign(false);
value && PgpUserStore.getKeyForSigning(value.email()).then(result => {
value = getEmail(value);
value && PgpUserStore.getKeyForSigning(value).then(result => {
console.log({
email: value.email(),
email: value,
canPgpSign:result
});
this.canPgpSign(result)
@ -373,6 +381,7 @@ class ComposePopupView extends AbstractViewPopup {
MessageFolder: this.draftsFolder(),
MessageUid: this.draftUid(),
SaveFolder: sSaveFolder,
From: this.from(),
To: this.to(),
Cc: this.cc(),
Bcc: this.bcc(),
@ -730,9 +739,10 @@ class ComposePopupView extends AbstractViewPopup {
}
selectIdentity(identity) {
if (identity && identity.item) {
this.currentIdentity(identity.item);
this.setSignatureFromIdentity(identity.item);
identity = identity && identity.item;
if (identity) {
this.currentIdentity(identity);
this.setSignatureFromIdentity(identity);
}
}
@ -1594,18 +1604,14 @@ class ComposePopupView extends AbstractViewPopup {
}
allRecipients() {
const email = new EmailModel();
return [
// From/sender is also recipient (Sent mailbox)
this.currentIdentity().email(),
// this.currentIdentity().email(),
this.from(),
this.to(),
this.cc(),
this.bcc()
].join(',').split(',').map(value => {
email.clear();
email.parse(value.trim());
return email.email || false;
}).validUnique();
].join(',').split(',').map(value => getEmail(value.trim())).validUnique();
}
initPgpEncrypt() {

View file

@ -1041,6 +1041,9 @@ trait Messages
$oMessage->DoesNotAddDefaultXMailer();
}
$sFrom = $this->GetActionParam('From', '');
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($sFrom));
/*
$oFromIdentity = $this->GetIdentityByID($oAccount, $this->GetActionParam('IdentityID', ''));
if ($oFromIdentity)
{
@ -1054,7 +1057,7 @@ trait Messages
{
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($oAccount->Email()));
}
*/
$oFrom = $oMessage->GetFrom();
$oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : '');

View file

@ -8,11 +8,56 @@
<span class="hide-mobile" data-i18n="GLOBAL/SAVE"></span>
</a>
<a class="close" data-bind="click: tryToClosePopup" data-i18n="[title]GLOBAL/CANCEL">×</a>
<a class="minimize-custom" data-bind="click: skipCommand" data-i18n="[title]COMPOSE/BUTTON_MINIMIZE"></a>
<a class="btn btn-danger button-delete fontastic" data-bind="command: deleteCommand">🗑</a>
<span class="saved-text hide-mobile" data-bind="text: savedTimeText"></span>
<div class="pull-right">
<a class="btn" data-i18n="GLOBAL/BCC" data-bind="visible: !showBcc(), click: function () { showBcc(true); }"></a>
<a class="btn fontastic" data-bind="visible: allowContacts, command: contactsCommand" data-i18n="[title]GLOBAL/CONTACTS">📇</a>
<div class="btn-group dropdown" data-bind="registerBootstrapDropdown: true" style="display:inline-block;vertical-align:top">
<a class="btn dropdown-toggle fontastic"></a>
<ul class="dropdown-menu right-edge" role="menu">
<li data-bind="click: function () { showBcc(!showBcc()); }">
<a>
<i class="fontastic" data-bind="text: showBcc() ? '☑' : '☐'"></i>
<span data-i18n="GLOBAL/BCC"></span>
</a>
</li>
<li data-bind="click: function () { showCc(!showCc()); }">
<a>
<i class="fontastic" data-bind="text: showCc() ? '☑' : '☐'"></i>
<span data-i18n="GLOBAL/CC"></span>
</a>
</li>
<li data-bind="click: function () { showReplyTo(!showReplyTo()); }">
<a>
<i class="fontastic" data-bind="text: showReplyTo() ? '☑' : '☐'"></i>
<span data-i18n="GLOBAL/REPLY_TO"></span>
</a>
</li>
<li data-bind="click: function () { requestReadReceipt(!requestReadReceipt()); }">
<a>
<i class="fontastic" data-bind="text: requestReadReceipt() ? '☑' : '☐'"></i>
<span data-i18n="COMPOSE/BUTTON_REQUEST_READ_RECEIPT"></span>
</a>
</li>
<li data-bind="click: function () { requestDsn(!requestDsn()); }">
<a>
<i class="fontastic" data-bind="text: requestDsn() ? '☑' : '☐'"></i>
<span data-i18n="COMPOSE/BUTTON_REQUEST_DSN"></span>
</a>
</li>
<li data-bind="click: function () { markAsImportant(!markAsImportant()); }">
<a>
<i class="fontastic" data-bind="text: markAsImportant() ? '☑' : '☐'"></i>
<span data-i18n="COMPOSE/BUTTON_MARK_AS_IMPORTANT"></span>
</a>
</li>
</ul>
</div>
<a class="minimize-custom" data-bind="click: skipCommand" data-i18n="[title]COMPOSE/BUTTON_MINIMIZE"></a>
<a class="close" data-bind="click: tryToClosePopup" data-i18n="[title]GLOBAL/CANCEL">×</a>
</div>
</header>
<div class="modal-body">
<div class="b-header g-ui-user-select-none">
@ -20,68 +65,17 @@
<tr>
<td data-i18n="GLOBAL/FROM"></td>
<td>
<input type="text" data-bind="textInput: from" style="width:calc(100% - 20px)">
<!-- ko if: 1 < identitiesOptions().length -->
<div class="dropdown" style="display:inline-block" data-bind="registerBootstrapDropdown: true, openDropdownTrigger: identitiesDropdownTrigger">
<a class="dropdown-toggle e-identity multiply" href="#" tabindex="-1"
id="identity-label-id" role="button"
data-bind="text: currentIdentityView">
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="identity-label-id" data-bind="foreach: identitiesOptions">
<a class="dropdown-toggle" href="#" tabindex="-1" id="identity-toggle" role="button"></a>
<ul class="dropdown-menu right-edge" role="menu" aria-labelledby="identity-toggle" 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>
<a class="btn fontastic" data-bind="visible: allowContacts, command: contactsCommand" data-i18n="[title]GLOBAL/CONTACTS">📇</a>
<div class="btn-group dropdown" data-bind="registerBootstrapDropdown: true" style="display:inline-block;vertical-align:top">
<a class="btn dropdown-toggle fontastic"></a>
<ul class="dropdown-menu right-edge" role="menu">
<li data-bind="click: function () { showBcc(!showBcc()); }">
<a>
<i class="fontastic" data-bind="text: showBcc() ? '☑' : '☐'"></i>
<span data-i18n="GLOBAL/BCC"></span>
</a>
</li>
<li data-bind="click: function () { showCc(!showCc()); }">
<a>
<i class="fontastic" data-bind="text: showCc() ? '☑' : '☐'"></i>
<span data-i18n="GLOBAL/CC"></span>
</a>
</li>
<li data-bind="click: function () { showReplyTo(!showReplyTo()); }">
<a>
<i class="fontastic" data-bind="text: showReplyTo() ? '☑' : '☐'"></i>
<span data-i18n="GLOBAL/REPLY_TO"></span>
</a>
</li>
<li data-bind="click: function () { requestReadReceipt(!requestReadReceipt()); }">
<a>
<i class="fontastic" data-bind="text: requestReadReceipt() ? '☑' : '☐'"></i>
<span data-i18n="COMPOSE/BUTTON_REQUEST_READ_RECEIPT"></span>
</a>
</li>
<li data-bind="click: function () { requestDsn(!requestDsn()); }">
<a>
<i class="fontastic" data-bind="text: requestDsn() ? '☑' : '☐'"></i>
<span data-i18n="COMPOSE/BUTTON_REQUEST_DSN"></span>
</a>
</li>
<li data-bind="click: function () { markAsImportant(!markAsImportant()); }">
<a>
<i class="fontastic" data-bind="text: markAsImportant() ? '☑' : '☐'"></i>
<span data-i18n="COMPOSE/BUTTON_MARK_AS_IMPORTANT"></span>
</a>
</li>
</ul>
</div>
</span>
</td>
</tr>
<tr>

View file

@ -101,7 +101,6 @@ dialog header, dialog footer,
}
.legend,
#V-PopupsCompose .b-header .e-identity,
.messageView #messageItem {
color: var(--main-color);
}