Skip to content

Commit

Permalink
GH-9633: MailReceiver: also set flags into IntegrationMimeMessage
Browse files Browse the repository at this point in the history
Fixes: #9633
Issue link: #9633

The message flags of the received messages are outdated and don't contain the changes of `AbstractMailReceiver#setMessageFlags`,
because the flags are only applied to the original message and not the copy (`AbstractMailReceiver.IntegrationMimeMessage`).

* Call `setMessageFlagsAndMaybeDeleteMessages()` for `IntegrationMimeMessage` copies as well

**Auto-cherry-pick to `6.3.x` & `6.2.x`**
  • Loading branch information
artembilan committed Nov 6, 2024
1 parent 846d655 commit 1d85d6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ private void postProcessFilteredMessages(Message[] filteredMessages) throws Mess
}

setMessageFlagsAndMaybeDeleteMessages(messages);
if (filteredMessages.length > 0 && filteredMessages[0] instanceof IntegrationMimeMessage) {
setMessageFlagsAndMaybeDeleteMessages(filteredMessages);
}
}

private void setMessageFlagsAndMaybeDeleteMessages(Message[] messages) throws MessagingException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public void receiveMarkAsReadAndDelete() throws Exception {
assertThat(msg1.getFlags().contains(Flag.SEEN)).isTrue();
assertThat(msg2.getFlags().contains(Flag.SEEN)).isTrue();

verify(receiver, times(1)).deleteMessages(Mockito.any());
verify(receiver, times(2)).deleteMessages(Mockito.any());
}

@Test
Expand Down

0 comments on commit 1d85d6b

Please sign in to comment.