fix(GODT-2337): filter reply-to on draft.

This commit is contained in:
Romain LE JEUNE
2023-04-12 08:31:35 +02:00
parent 4e7a669260
commit 54b209f9e1
7 changed files with 93 additions and 19 deletions

View File

@ -209,6 +209,7 @@ func TestFeatures(testingT *testing.T) {
ctx.Step(`^IMAP client "([^"]*)" appends "([^"]*)" to "([^"]*)"$`, s.imapClientAppendsToMailbox)
ctx.Step(`^IMAP clients "([^"]*)" and "([^"]*)" move message with subject "([^"]*)" of "([^"]*)" to "([^"]*)" by ([^"]*) ([^"]*) ([^"]*)`, s.imapClientsMoveMessageWithSubjectUserFromToByOrderedOperations)
ctx.Step(`^IMAP client "([^"]*)" sees header "([^"]*)" in message with subject "([^"]*)" in "([^"]*)"$`, s.imapClientSeesHeaderInMessageWithSubject)
ctx.Step(`^IMAP client "([^"]*)" does not see header "([^"]*)" in message with subject "([^"]*)" in "([^"]*)"$`, s.imapClientDoesNotSeeHeaderInMessageWithSubject)
// ==== SMTP ====
ctx.Step(`^user "([^"]*)" connects SMTP client "([^"]*)"$`, s.userConnectsSMTPClient)

View File

@ -34,6 +34,7 @@ Feature: IMAP Draft messages
| to | subject | body |
| someone@example.com | Basic Draft | This is a draft, but longer |
And IMAP client "1" eventually sees 1 messages in "Drafts"
And IMAP client "1" does not see header "Reply-To" in message with subject "Basic Draft" in "Drafts"
Scenario: Draft edited remotely
When the following fields were changed in draft 1 for address "[user:user]@[domain]" of account "[user:user]":
@ -43,6 +44,7 @@ Feature: IMAP Draft messages
| to | subject | body |
| someone@example.com | Basic Draft | This is a draft body, but longer |
And IMAP client "1" eventually sees 1 messages in "Drafts"
And IMAP client "1" does not see header "Reply-To" in message with subject "Basic Draft" in "Drafts"
Scenario: Draft moved to trash remotely
When draft 1 for address "[user:user]@[domain]" of account "[user:user]" was moved to trash

View File

@ -5,9 +5,9 @@ Feature: SMTP send reply
And there exists an account with username "[user:user2]" and password "password"
And bridge starts
And the user logs in with username "[user:user1]" and password "password"
And user "[user:user1]" finishes syncing
And user "[user:user1]" connects and authenticates SMTP client "1"
And user "[user:user1]" connects and authenticates IMAP client "1"
And user "[user:user1]" finishes syncing
@long-black
Scenario: Reply with In-Reply-To but no References
@ -33,8 +33,8 @@ Feature: SMTP send reply
And user "[user:user2]" finishes syncing
# User2 receive the message.
Then IMAP client "2" eventually sees the following messages in "INBOX":
| from | subject | message-id |
| [user:user1]@[domain] | Please Reply | <something@protonmail.ch> |
| from | subject | message-id | reply-to |
| [user:user1]@[domain] | Please Reply | <something@protonmail.ch> | [user:user1]@[domain] |
# User2 reply to it.
When SMTP client "2" sends the following message from "[user:user2]@[domain]" to "[user:user1]@[domain]":
"""
@ -53,8 +53,8 @@ Feature: SMTP send reply
| [user:user2]@[domain] | [user:user1]@[domain] | FW - Please Reply | <something@protonmail.ch> | <something@protonmail.ch> |
# User1 receive the reply.|
And IMAP client "1" eventually sees the following messages in "INBOX":
| from | subject | body | in-reply-to | references |
| [user:user2]@[domain] | FW - Please Reply | Heya | <something@protonmail.ch> | <something@protonmail.ch> |
| from | subject | body | in-reply-to | references | reply-to |
| [user:user2]@[domain] | FW - Please Reply | Heya | <something@protonmail.ch> | <something@protonmail.ch> | [user:user2]@[domain] |
@long-black
Scenario: Reply with References but no In-Reply-To
@ -80,8 +80,8 @@ Feature: SMTP send reply
And user "[user:user2]" finishes syncing
# User2 receive the message.
Then IMAP client "2" eventually sees the following messages in "INBOX":
| from | subject | message-id |
| [user:user1]@[domain] | Please Reply | <something@protonmail.ch> |
| from | subject | message-id | reply-to |
| [user:user1]@[domain] | Please Reply | <something@protonmail.ch> | [user:user1]@[domain] |
# User2 reply to it.
When SMTP client "2" sends the following message from "[user:user2]@[domain]" to "[user:user1]@[domain]":
"""
@ -100,8 +100,8 @@ Feature: SMTP send reply
| [user:user2]@[domain] | [user:user1]@[domain] | FW - Please Reply | <something@protonmail.ch> | <something@protonmail.ch> |
# User1 receive the reply.|
And IMAP client "1" eventually sees the following messages in "INBOX":
| from | subject | body | in-reply-to | references |
| [user:user2]@[domain] | FW - Please Reply | Heya | <something@protonmail.ch> | <something@protonmail.ch> |
| from | subject | body | in-reply-to | references | reply-to |
| [user:user2]@[domain] | FW - Please Reply | Heya | <something@protonmail.ch> | <something@protonmail.ch> | [user:user2]@[domain] |
@long-black
@ -128,8 +128,8 @@ Feature: SMTP send reply
And user "[user:user2]" finishes syncing
# User2 receive the message.
Then IMAP client "2" eventually sees the following messages in "INBOX":
| from | subject | message-id |
| [user:user1]@[domain] | Please Reply | <something@protonmail.ch> |
| from | subject | message-id | reply-to |
| [user:user1]@[domain] | Please Reply | <something@protonmail.ch> | [user:user1]@[domain] |
# User2 reply to it.
When SMTP client "2" sends the following message from "[user:user2]@[domain]" to "[user:user1]@[domain]":
"""
@ -149,5 +149,5 @@ Feature: SMTP send reply
| [user:user2]@[domain] | [user:user1]@[domain] | FW - Please Reply | <something@protonmail.ch> | <something@protonmail.ch> |
# User1 receive the reply.|
And IMAP client "1" eventually sees the following messages in "INBOX":
| from | subject | body | in-reply-to | references |
| [user:user2]@[domain] | FW - Please Reply | Heya | <something@protonmail.ch> | <something@protonmail.ch> |
| from | subject | body | in-reply-to | references | reply-to |
| [user:user2]@[domain] | FW - Please Reply | Heya | <something@protonmail.ch> | <something@protonmail.ch> | [user:user2]@[domain] |

View File

@ -297,7 +297,6 @@ func (s *scenario) imapClientSeesTheFollowingMessagesInMailbox(clientID, mailbox
if err != nil {
return err
}
return matchMessages(haveMessages, wantMessages)
}
@ -575,6 +574,14 @@ func (s *scenario) imapClientSeesHeaderInMessageWithSubject(clientID, headerStri
return fmt.Errorf("could not find message with given subject '%v'", subject)
}
func (s *scenario) imapClientDoesNotSeeHeaderInMessageWithSubject(clientID, headerString, subject, mailbox string) error {
err := s.imapClientSeesHeaderInMessageWithSubject(clientID, headerString, subject, mailbox)
if err == nil {
return fmt.Errorf("message header contains '%v'", headerString)
}
return nil
}
func clientList(client *client.Client) []*imap.MailboxInfo {
resCh := make(chan *imap.MailboxInfo)

View File

@ -43,10 +43,11 @@ type Message struct {
MessageID string `bdd:"message-id"`
Date string `bdd:"date"`
From string `bdd:"from"`
To string `bdd:"to"`
CC string `bdd:"cc"`
BCC string `bdd:"bcc"`
From string `bdd:"from"`
To string `bdd:"to"`
CC string `bdd:"cc"`
BCC string `bdd:"bcc"`
ReplyTo string `bdd:"reply-to"`
Unread bool `bdd:"unread"`
Deleted bool `bdd:"deleted"`
@ -158,6 +159,10 @@ func newMessageFromIMAP(msg *imap.Message) Message {
message.BCC = msg.Envelope.Bcc[0].Address()
}
if len(msg.Envelope.ReplyTo) > 0 {
message.ReplyTo = msg.Envelope.ReplyTo[0].Address()
}
return message
}