mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
fix(mail): Fix inline text issue when Hide inline attachment option is set
This commit is contained in:
@@ -124,21 +124,18 @@
|
||||
info = [self childInfo];
|
||||
|
||||
ud = [[[self context] activeUser] userDefaults];
|
||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||
[viewer setBodyInfo: info];
|
||||
[viewer setPartPath: [self childPartPath]];
|
||||
if ([self decodedFlatContent])
|
||||
[viewer setDecodedContent: [parts objectAtIndex: i]];
|
||||
[viewer setAttachmentIds: attachmentIds
|
||||
displayAttachment:!([info objectForKey:@"disposition"]
|
||||
&& [[info objectForKey:@"disposition"] objectForKey:@"type"]
|
||||
&& [[[[info objectForKey:@"disposition"] objectForKey:@"type"] uppercaseString] isEqualToString:@"INLINE"]
|
||||
&& [ud hideInlineAttachments])];
|
||||
|
||||
if (!([info objectForKey:@"disposition"]
|
||||
&& [[info objectForKey:@"disposition"] objectForKey:@"type"]
|
||||
&& [[[[info objectForKey:@"disposition"] objectForKey:@"type"] uppercaseString] isEqualToString:@"INLINE"]
|
||||
&& [ud hideInlineAttachments])) {
|
||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||
[viewer setBodyInfo: info];
|
||||
[viewer setPartPath: [self childPartPath]];
|
||||
if ([self decodedFlatContent])
|
||||
[viewer setDecodedContent: [parts objectAtIndex: i]];
|
||||
[viewer setAttachmentIds: attachmentIds];
|
||||
|
||||
|
||||
[renderedParts addObject: [viewer renderedPart]];
|
||||
}
|
||||
[renderedParts addObject: [viewer renderedPart]];
|
||||
}
|
||||
|
||||
contentType = [NSString stringWithFormat: @"%@/%@",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
@class NSData;
|
||||
@class NSFormatter;
|
||||
@class NSMutableDictionary;
|
||||
@class NSNumber;
|
||||
|
||||
@class SOGoMailBodyPart;
|
||||
|
||||
@@ -56,6 +57,7 @@
|
||||
NSData *flatContent;
|
||||
id decodedContent;
|
||||
NSDictionary *attachmentIds;
|
||||
BOOL _shouldDisplayAttachment;
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
@@ -71,6 +73,7 @@
|
||||
|
||||
- (NSDictionary *) attachmentIds;
|
||||
- (void) setAttachmentIds: (NSDictionary *) newAttachmentIds;
|
||||
- (void) setAttachmentIds:(NSDictionary *)newAttachmentIds displayAttachment:(BOOL)shouldDisplayAttachment;
|
||||
|
||||
- (NSData *)flatContent;
|
||||
- (void) setFlatContent: (NSData *) theData;
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
attachmentIds = nil;
|
||||
flatContent = nil;
|
||||
decodedContent = nil;
|
||||
_shouldDisplayAttachment = YES;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -204,6 +205,7 @@
|
||||
[[self sizeFormatter] stringForObjectValue: [bodyInfo objectForKey: @"size"]], @"size",
|
||||
[self pathToAttachment], @"viewURL",
|
||||
[self pathForDownload], @"downloadURL",
|
||||
[NSNumber numberWithBool:_shouldDisplayAttachment], @"shouldDisplayAttachment",
|
||||
nil];
|
||||
}
|
||||
|
||||
@@ -222,6 +224,12 @@
|
||||
attachmentIds = newAttachmentIds;
|
||||
}
|
||||
|
||||
- (void) setAttachmentIds:(NSDictionary *)newAttachmentIds displayAttachment:(BOOL)shouldDisplayAttachment
|
||||
{
|
||||
[self setAttachmentIds: newAttachmentIds];
|
||||
_shouldDisplayAttachment = shouldDisplayAttachment;
|
||||
}
|
||||
|
||||
- (NSString *) flatContentAsString
|
||||
{
|
||||
NSString *charset, *s;
|
||||
|
||||
@@ -461,7 +461,9 @@
|
||||
|
||||
// Trusted content that can be compiled (Angularly-speaking)
|
||||
part.compile = true;
|
||||
parts.push(part);
|
||||
if (!Object.hasOwn(part, 'shouldDisplayAttachment') || 1 == part.shouldDisplayAttachment ) {
|
||||
parts.push(part);
|
||||
}
|
||||
}
|
||||
else {
|
||||
part.html = true;
|
||||
|
||||
Reference in New Issue
Block a user