GODT-1556: If no references, use the in-reply-to header as ParentID.

This commit is contained in:
Romain LE JEUNE 2023-01-20 11:01:17 +01:00
parent ee4da8a89c
commit f1404cd3ee
No known key found for this signature in database
GPG Key ID: 664A57E2F9CD8118
2 changed files with 6 additions and 2 deletions

View File

@ -101,7 +101,7 @@ func TestBridge_Send(t *testing.T) {
defer recipientIMAPClient.Logout() //nolint:errcheck
// Sender should have 10 messages in the sent folder.
// Recipient should have 0 messages in inbox.
// Recipient should have 10 messages in inbox.
require.Eventually(t, func() bool {
sent, err := senderIMAPClient.Status(`Sent`, []imap.StatusItem{imap.StatusMessages})
require.NoError(t, err)

View File

@ -174,7 +174,11 @@ func sendWithKey( //nolint:funlen
to []string,
message message.Message,
) (proton.Message, error) {
parentID, err := getParentID(ctx, client, authAddrID, addrMode, message.References)
references := message.References
if message.InReplyTo != "" {
references = append(references, message.InReplyTo)
}
parentID, err := getParentID(ctx, client, authAddrID, addrMode, references)
if err != nil {
return proton.Message{}, fmt.Errorf("failed to get parent ID: %w", err)
}