Return actual root part of message in MessageViewInfo (fixes #3004)

This commit is contained in:
Vincent Breitmoser 2018-01-28 12:57:05 +01:00
parent 7c3b90b356
commit 8b11a7284e
3 changed files with 7 additions and 3 deletions

View file

@ -37,10 +37,10 @@ public class MessageViewInfo {
this.extraAttachments = extraAttachments;
}
static MessageViewInfo createWithExtractedContent(Message message, boolean isMessageIncomplete,
static MessageViewInfo createWithExtractedContent(Message message, Part rootPart, boolean isMessageIncomplete,
String text, List<AttachmentViewInfo> attachments, AttachmentResolver attachmentResolver) {
return new MessageViewInfo(
message, isMessageIncomplete, message, text, attachments, null, attachmentResolver, null,
message, isMessageIncomplete, rootPart, text, attachments, null, attachmentResolver, null,
Collections.<AttachmentViewInfo>emptyList());
}

View file

@ -124,7 +124,7 @@ public class MessageViewInfoExtractor {
!message.isSet(Flag.X_DOWNLOADED_FULL) || MessageExtractor.hasMissingParts(message);
return MessageViewInfo.createWithExtractedContent(
message, isMessageIncomplete, viewable.html, attachmentInfos, attachmentResolver);
message, contentPart, isMessageIncomplete, viewable.html, attachmentInfos, attachmentResolver);
}
private ViewableExtractedText extractViewableAndAttachments(List<Part> parts,

View file

@ -406,6 +406,8 @@ public class MessageViewInfoExtractorTest {
assertEquals("<pre class=\"k9mail\">text</pre>", messageViewInfo.text);
assertSame(annotation, messageViewInfo.cryptoResultAnnotation);
assertSame(message, messageViewInfo.message);
assertSame(message, messageViewInfo.rootPart);
assertTrue(messageViewInfo.attachments.isEmpty());
assertTrue(messageViewInfo.extraAttachments.isEmpty());
}
@ -427,6 +429,8 @@ public class MessageViewInfoExtractorTest {
assertEquals("<pre class=\"k9mail\">replacement text</pre>", messageViewInfo.text);
assertSame(annotation, messageViewInfo.cryptoResultAnnotation);
assertSame(message, messageViewInfo.message);
assertSame(replacementPart, messageViewInfo.rootPart);
assertTrue(messageViewInfo.attachments.isEmpty());
assertTrue(messageViewInfo.extraAttachments.isEmpty());
}