Merge pull request #5768 from vector-im/andy/redacted_messages

Do not render redacted messages
This commit is contained in:
Anderas
2022-03-08 11:55:02 +00:00
committed by GitHub
+7 -5
View File
@@ -69,11 +69,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
// If we cannot create attributed string, but the message is nevertheless meant for display (e.g. not an edit event), show generic error
// instead of a missing message on a timeline.
if (
!string
&& [self.eventTypesFilterForMessages containsObject:event.type]
&& !event.isEditEvent
)
if (!string && [self shouldDisplayEvent:event])
{
MXLogError(@"[EventFormatter]: Cannot format string for displayable event: %@, type: %@, msgtype: %@, has room state: %d, members: %lu, error: %lu",
event.eventId,
@@ -89,6 +85,12 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
return string;
}
- (BOOL)shouldDisplayEvent:(MXEvent *)event {
return [self.eventTypesFilterForMessages containsObject:event.type]
&& !event.isEditEvent
&& !event.isRedactedEvent;
}
// The attributed string can fail to be created for a number of reasons, and the size of the function (as well as super's implementation) makes
// it impossible to catch all the `return nil` and failure states.
// To make catching of missing strings reliable (and not place that burden on callers), we use private `unsafeAttributedStringFromEvent` method