Merge pull request #3146 from k9mail/fix-crypto-quote

Return actual root part of message in MessageViewInfo (fixes #3004)
This commit is contained in:
cketti 2018-01-28 18:28:05 +01:00 committed by GitHub
commit 1962defd5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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());
}