-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Remove messages for non selected mailboxes with update
Fixes a bug where the messages were not removed from mailboxes if they are not selected by any clients.
- Loading branch information
1 parent
c7a38cb
commit d8206f6
Showing
2 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package tests | |
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestDeleted(t *testing.T) { | ||
|
@@ -131,3 +132,48 @@ func TestUIDDeleted(t *testing.T) { | |
c.S(`A00E OK STATUS`) | ||
}) | ||
} | ||
|
||
func TestRemoteDeleteOnSelectedMailboxRemoveMessageFromMailbox(t *testing.T) { | ||
runOneToOneTestWithAuth(t, defaultServerOptions(t), func(c *testConnection, s *testSession) { | ||
mailboxID := s.mailboxCreated("user", []string{"mbox1"}) | ||
messageID1 := s.messageCreated("user", mailboxID, []byte("To: [email protected]"), time.Now()) | ||
s.messageCreated("user", mailboxID, []byte("To: [email protected]"), time.Now()) | ||
|
||
s.flush("user") | ||
|
||
c.C(`A002 STATUS mbox1 (MESSAGES)`) | ||
c.S(`* STATUS "mbox1" (MESSAGES 2)`) | ||
c.S(`A002 OK STATUS`) | ||
|
||
c.C("A003 SELECT mbox1").OK("A003") | ||
|
||
s.messageDeleted("user", messageID1) | ||
s.flush("user") | ||
|
||
c.C(`A002 STATUS mbox1 (MESSAGES)`) | ||
c.S(`* 1 EXPUNGE`) | ||
c.S(`* STATUS "mbox1" (MESSAGES 1)`) | ||
c.S(`A002 OK STATUS`) | ||
}) | ||
} | ||
|
||
func TestRemoteDeleteOnNonSelectedMailboxRemoveMessageFromMailbox(t *testing.T) { | ||
runOneToOneTestWithAuth(t, defaultServerOptions(t), func(c *testConnection, s *testSession) { | ||
mailboxID := s.mailboxCreated("user", []string{"mbox1"}) | ||
messageID1 := s.messageCreated("user", mailboxID, []byte("To: [email protected]"), time.Now()) | ||
s.messageCreated("user", mailboxID, []byte("To: [email protected]"), time.Now()) | ||
|
||
s.flush("user") | ||
|
||
c.C(`A002 STATUS mbox1 (MESSAGES)`) | ||
c.S(`* STATUS "mbox1" (MESSAGES 2)`) | ||
c.S(`A002 OK STATUS`) | ||
|
||
s.messageDeleted("user", messageID1) | ||
s.flush("user") | ||
|
||
c.C(`A002 STATUS mbox1 (MESSAGES)`) | ||
c.S(`* STATUS "mbox1" (MESSAGES 1)`) | ||
c.S(`A002 OK STATUS`) | ||
}) | ||
} |