Skip to content

Conversation

@rrrooommmaaa
Copy link
Contributor

@rrrooommmaaa rrrooommmaaa commented Feb 13, 2022

close #4348

also this PR correctly stores threadId when saving sent messages


Tests (delete all except exactly one):

  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@rrrooommmaaa
Copy link
Contributor Author

I see FES still returns { url } only, so it hasn't been updated yet?

@rrrooommmaaa
Copy link
Contributor Author

ping @tomholub

@rrrooommmaaa
Copy link
Contributor Author

Should we merge now or wait until FES is updated to test it again manually?

@tomholub
Copy link
Collaborator

tomholub commented Mar 7, 2022

I'll take a look

@tomholub
Copy link
Collaborator

Sorry for lack of info. Indeed, I suppose we didn't update FES yet. I'll let you know once updated.

@rrrooommmaaa rrrooommmaaa changed the title Bind email gateway message id Individual message per recipient Mar 26, 2022
@rrrooommmaaa rrrooommmaaa mentioned this pull request Mar 26, 2022
5 tasks
@tomholub
Copy link
Collaborator

tomholub commented Apr 2, 2022

We can discuss this one once rebased onto master. Thanks!

@rrrooommmaaa rrrooommmaaa force-pushed the issue-4269-message-gateway-update branch from 0a4d19d to 215a0e9 Compare April 4, 2022 09:45
@rrrooommmaaa
Copy link
Contributor Author

rrrooommmaaa commented Apr 4, 2022

We can discuss this one once rebased onto master. Thanks!

The sending works, now the principal issue is how we should display the sent messages in the thread?
Previously the thread of messages was tracked by threadId. As a solitary message was sent for both pwd link and embedded encrypted message, this message was put into the thread without any problems.
Now that we send a separate encrypted message and several pwd link messages, we need to think through how we visually collapse them into one.

@tomholub
Copy link
Collaborator

tomholub commented Apr 5, 2022

Let's not worry about it in this PR, and then evaluate it in another issue/PR.

for new messages: If Gmail classifies it as many threads of one message each, then that's what it is

for replies, since we are adding thread ids, several messages will all show up in that one thread, and I suppose they'll look identical except for recipients.

In another issue, we could only actually render the first one, and then for all that directly follow and belong to the same "group" we may collapse them somehow.

Mobile apps could be more clever about this, since we have full control.

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some thoughts.

One thing to think about is format of the sent message. Till now, we were sending both link and encrypted data in attachment in the same message (encrypted data attached directly for any pgp recipients and the sender, and link for non-pgp). But it's not realistic to send that to 20 recipients.. so we will have to rethink that.

@rrrooommmaaa rrrooommmaaa force-pushed the issue-4269-message-gateway-update branch from 184d6ae to 1b0aeea Compare April 13, 2022 12:22
@rrrooommmaaa rrrooommmaaa force-pushed the issue-4269-message-gateway-update branch from e8cde1d to 6e1c417 Compare April 15, 2022 08:17
@rrrooommmaaa rrrooommmaaa requested a review from tomholub June 12, 2022 11:47
@rrrooommmaaa
Copy link
Contributor Author

@tomholub updated according to your requests, please re-review

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like all these changes following the review - that looks good. I skipped encrypted-mail-msg-formatter.ts which I still have to look into. Plus need to do some manual testing.

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm filing some comments for "later" and resolving them here in this review.

The ones I leave unresolved should be done still in this PR now.

Comment on lines 184 to 197
private sendablePwdMsg = async (
newMsg: NewMsgData,
pubs: PubkeyResult[],
{ msgUrl, externalId }: { msgUrl: string, externalId?: string },
signingPrv?: Key) => {
// encoded as: PGP/MIME-like structure but with attachments as external files due to email size limit (encrypted for pubkeys only)
const msgBody = this.richtext ? { 'text/plain': newMsg.plaintext, 'text/html': newMsg.plainhtml } : { 'text/plain': newMsg.plaintext };
const pgpMimeNoAttachments = await Mime.encode(msgBody, { Subject: newMsg.subject }, []); // no attachments, attached to email separately
const { data: pubEncryptedNoAttachments } = await this.encryptDataArmor(Buf.fromUtfStr(pgpMimeNoAttachments), undefined, pubs, signingPrv); // encrypted only for pubs
const attachments = this.createPgpMimeAttachments(pubEncryptedNoAttachments).
concat(await this.view.attachmentsModule.attachment.collectEncryptAttachments(pubs)); // encrypted only for pubs
const emailIntroAndLinkBody = await this.formatPwdEncryptedMsgBodyLink(msgUrl);
return await SendableMsg.createPwdMsg(this.acctEmail, this.headers(newMsg), emailIntroAndLinkBody, attachments, { isDraft: this.isDraft, externalId });
return await SendableMsg.createPwdMsg(this.acctEmail, this.headers(newMsg), emailIntroAndLinkBody,
this.createPgpMimeAttachments(pubEncryptedNoAttachments),
{ isDraft: this.isDraft, externalId });
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a refactor in another issue:

  • this sendablePwdMsg method could be removed
  • formatSendablePwdMsgs could call const emailIntroAndLinkBody = await this.formatPwdEncryptedMsgBodyLink(msgUrl); and return await SendableMsg.createPwdMsg(this.acctEmail, this.headers(newMsg), emailIntroAndLinkBody, messageBodyAsPgpMimeAttachmentsEncryptedForSender, { isDraft: this.isDraft, externalId });
  • messageBodyAsPgpMimeAttachmentsEncryptedForSender could be created only once, and reused in each cycle of the loop in formatSendablePwdMsgs
  • to create messageBodyAsPgpMimeMetaAttachmentsEncryptedForSender you could reuse most of existing sendablePwdMsg that relates to creating this pgpmime attachments, and this new method could be called encryptMessageBodyAsPgpMimeMetaAttachments and only sender pubkeys would be passed into it to create messageBodyAsPgpMimeMetaAttachmentsEncryptedForSender

The point is that this encryption only needs to happen once per batch, not once per each pwd msg, and it only needs to use pubkeys of sender, not everybody's pubkeys.

Copy link
Collaborator

@tomholub tomholub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I still need to do some manual tests before merging.

@tomholub tomholub merged commit fae2bb7 into master Jul 9, 2022
@tomholub tomholub deleted the issue-4269-message-gateway-update branch July 9, 2022 09:42
this.view.S.cached('reply_msg_successful').find('div.replied_cc span').text(msg.recipients.cc.join(', '));
this.view.S.cached('reply_msg_successful').find('div.replied_to span').text(Str.formatEmailList(recipients.to || []));
if (recipients.cc !== undefined && recipients.cc.length > 0) {
this.view.S.cached('reply_msg_successful').find('div.replied_cc span').text(Str.formatEmailList(recipients.cc));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes #4497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

send one message per web portal recipient, each with different url

5 participants