Skip to content

Commit

Permalink
Merge branch 'release/1.8.5/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderas committed Mar 9, 2022
2 parents 33f39bf + cfc2e25 commit 9b23dd3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Changes in 1.8.5 (2022-03-09)

🐛 Bugfixes

- Room: Only render missing messages for m.room.message types ([#5783](https://github.com/vector-im/element-ios/issues/5783))


## Changes in 1.8.4 (2022-03-08)

🙌 Improvements
Expand Down
4 changes: 2 additions & 2 deletions Config/AppVersion.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
//

// Version
MARKETING_VERSION = 1.8.4
CURRENT_PROJECT_VERSION = 1.8.4
MARKETING_VERSION = 1.8.5
CURRENT_PROJECT_VERSION = 1.8.5
21 changes: 12 additions & 9 deletions Riot/Utils/EventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,30 @@ - (void)initDateTimeFormatters
- (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState:(MXRoomState *)roomState error:(MXKEventFormatterError *)error
{
NSAttributedString *string = [self unsafeAttributedStringFromEvent:event withRoomState:roomState error:error];

// 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 shouldDisplayEvent:event])
if (!string)
{
MXLogError(@"[EventFormatter]: Cannot format string for displayable event: %@, type: %@, msgtype: %@, has room state: %d, members: %lu, error: %lu",
MXLogDebug(@"[EventFormatter]: No attributed string for event: %@, type: %@, msgtype: %@, has room state: %d, members: %lu, error: %lu",
event.eventId,
event.type,
event.content[@"msgtype"],
roomState != nil,
roomState.membersCount.members,
*error);
string = [[NSAttributedString alloc] initWithString:[VectorL10n noticeErrorUnformattableEvent] attributes:@{
NSFontAttributeName: [self encryptedMessagesTextFont]
}];

// If we cannot create attributed string, but the message is nevertheless meant for display, show generic error
// instead of a missing message on a timeline.
if ([self shouldDisplayEvent:event]) {
MXLogError(@"[EventFormatter]: Missing attributed string for message event: %@", event.eventId);
string = [[NSAttributedString alloc] initWithString:[VectorL10n noticeErrorUnformattableEvent] attributes:@{
NSFontAttributeName: [self encryptedMessagesTextFont]
}];
}
}
return string;
}

- (BOOL)shouldDisplayEvent:(MXEvent *)event {
return [self.eventTypesFilterForMessages containsObject:event.type]
return event.eventType == MXEventTypeRoomMessage
&& !event.isEditEvent
&& !event.isRedactedEvent;
}
Expand Down

0 comments on commit 9b23dd3

Please sign in to comment.