From e2c171f302e94c59cfb7369b103d134ce5fb77ab Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 15 Feb 2022 10:22:52 +0100 Subject: [PATCH] Resolve #202 --- dev/Model/Identity.js | 2 +- dev/Styles/User/Compose.less | 34 +++--- dev/View/Popup/Compose.js | 44 ++++--- .../libraries/RainLoop/Actions/Messages.php | 5 +- .../templates/Views/User/PopupsCompose.html | 108 +++++++++--------- .../v/0.0.0/themes/SquaresDark/styles.css | 1 - 6 files changed, 94 insertions(+), 100 deletions(-) diff --git a/dev/Model/Identity.js b/dev/Model/Identity.js index 9e3e82649..bb3f4379f 100644 --- a/dev/Model/Identity.js +++ b/dev/Model/Identity.js @@ -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; } } diff --git a/dev/Styles/User/Compose.less b/dev/Styles/User/Compose.less index 4f52e0270..c7294d7af 100644 --- a/dev/Styles/User/Compose.less +++ b/dev/Styles/User/Compose.less @@ -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; } diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 043909876..05832e299 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -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() { diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php index fe4b7f39d..cd133a55f 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php @@ -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() : ''); diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html index 2e3609888..b793911a7 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsCompose.html @@ -8,11 +8,56 @@ - × - - 🗑 + +
+ + 📇 + + + × +