forked from Silverfish/proton-bridge
Fix appending to Sent
This commit is contained in:
@ -23,6 +23,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
### Fixed
|
||||
* Use correct binary name when finding location of addcert.scpt
|
||||
* GODT-143 Allow appending to Sent folder when sender matches account address
|
||||
|
||||
## [v1.2.6] Donghai - beta (2020-03-31)
|
||||
|
||||
|
||||
@ -126,10 +126,6 @@ func (im *imapMailbox) CreateMessage(flags []string, date time.Time, body imap.L
|
||||
|
||||
// We didn't find the message in the store, so we are currently sending it.
|
||||
logEntry.WithField("time", date).Info("No matching UID, continuing APPEND to Sent")
|
||||
|
||||
// For now we don't import user's own messages to Sent because GetUIDByHeader is not smart enough.
|
||||
// This will be fixed in GODT-143.
|
||||
return nil
|
||||
}
|
||||
|
||||
// This is an APPEND to the Sent folder, so we will set the sent flag
|
||||
|
||||
@ -219,6 +219,11 @@ func (storeMailbox *Mailbox) GetUIDByHeader(header *mail.Header) (foundUID uint3
|
||||
// in PM message. Message-Id in normal copy/move will be the PM internal ID.
|
||||
messageID := header.Get("Message-Id")
|
||||
|
||||
// There is nothing to find, when no Message-Id given.
|
||||
if messageID == "" {
|
||||
return uint32(0)
|
||||
}
|
||||
|
||||
// The most often situation is that message is APPENDed after it was sent so the
|
||||
// Message-ID will be reflected by ExternalID in API message meta-data.
|
||||
externalID := strings.Trim(messageID, "<> ") // remove '<>' to improve match
|
||||
|
||||
@ -36,6 +36,14 @@ graph LR
|
||||
We want to test Bridge app from outside as much as possible. So we mock server (API),
|
||||
credentials store and call commands to IMAP or SMTP the same way as client would do.
|
||||
|
||||
## Running tests
|
||||
|
||||
In order to run Integration tests just go into the test folder `cd test`
|
||||
and run `make test`.
|
||||
|
||||
You can also test only specific feature (or subset of features) by using `FEATURES` environment
|
||||
variable: `FEATURES=features/imap/message/create.feature make test`.
|
||||
|
||||
## Example test
|
||||
|
||||
BDD test in gherkin (cucumber) format (https://cucumber.io/docs/gherkin/reference/).
|
||||
@ -99,6 +107,10 @@ we can always be sure what each steps does or should do.
|
||||
In the code, we separate those parts in its own files to make sure
|
||||
it's clear how the function should be implemented.
|
||||
|
||||
In the `Given` phase is also generally better to setup data (as `there are messages...`)
|
||||
first, then users (`there is connected user...`) and then connections (`there is IMAP client...`).
|
||||
This can prevent some hitches in internal implementation of integration tests.
|
||||
|
||||
## API faked by fakeapi or liveapi
|
||||
|
||||
We need to control what server returns. Instead of using raw JSONs,
|
||||
|
||||
@ -18,7 +18,6 @@ Feature: IMAP create messages
|
||||
| from | to | subject | read |
|
||||
| [primary] | john.doe@email.com | foo | true |
|
||||
|
||||
@ignore
|
||||
Scenario: Creates message sent from user's primary address
|
||||
Given there is IMAP client selected in "Sent"
|
||||
When IMAP client creates message "foo" from address "primary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent"
|
||||
@ -29,7 +28,6 @@ Feature: IMAP create messages
|
||||
| [primary] | john.doe@email.com | foo | true |
|
||||
And mailbox "INBOX" for "userMoreAddresses" has no messages
|
||||
|
||||
@ignore
|
||||
Scenario: Creates message sent from user's secondary address
|
||||
Given there is IMAP client selected in "Sent"
|
||||
When IMAP client creates message "foo" from address "secondary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent"
|
||||
@ -57,3 +55,16 @@ Feature: IMAP create messages
|
||||
| from | to | subject | read |
|
||||
| notuser@gmail.com | alsonotuser@gmail.com | foo | true |
|
||||
And mailbox "INBOX" for "userMoreAddresses" has no messages
|
||||
|
||||
# Importing duplicate messages when messageID cannot be found in Sent already.
|
||||
#
|
||||
# Previously, we discarded messages for which sender matches account address to
|
||||
# avoid duplicates, but this led to discarding messages imported through mail client.
|
||||
Scenario: Imports a similar (duplicate) message to sent
|
||||
Given there are messages in mailbox "Sent" for "userMoreAddresses"
|
||||
| from | to | subject | body |
|
||||
| [primary] | chosen@one.com | Meet the Twins | Hello, Mr. Anderson |
|
||||
And there is IMAP client selected in "Sent"
|
||||
When IMAP client creates message "Meet the Twins" from address "primary" of "userMoreAddresses" to "chosen@one.com" with body "Hello, Mr. Anderson" in "Sent"
|
||||
Then IMAP response is "OK"
|
||||
Then mailbox "Sent" for "userMoreAddresses" has 2 messages
|
||||
Reference in New Issue
Block a user