[EventFormatter] Update room create event type processing when content has room predecessor info.

This commit is contained in:
SBiOSoftWhare
2018-08-07 11:23:03 +02:00
parent 2e0b51b8e2
commit ab91d3f69a
+14 -9
View File
@@ -115,9 +115,20 @@ NSString *const kEventFormatterOnReRequestKeysLinkActionSeparator = @"/";
}
}
if (event.eventType == MXEventTypeRoomCreate && roomState.hasRoomPredecessor)
if (event.eventType == MXEventTypeRoomCreate)
{
return [self roomCreatePredecessorAttributedStringFromRoomCreateContent:roomState.roomCreateContent];
MXRoomCreateContent *createContent = [MXRoomCreateContent modelFromJSON:event.content];
NSString *roomPredecessorId = createContent.roomPredecessorInfo.roomId;
if (roomPredecessorId)
{
return [self roomCreatePredecessorAttributedStringWithPredecessorRoomId:roomPredecessorId];
}
else
{
return nil;
}
}
NSAttributedString *attributedString = [super attributedStringFromEvent:event withRoomState:roomState error:error];
@@ -559,14 +570,8 @@ NSString *const kEventFormatterOnReRequestKeysLinkActionSeparator = @"/";
#pragma mark - Room create predecessor
- (NSAttributedString*)roomCreatePredecessorAttributedStringFromRoomCreateContent:(MXRoomCreateContent*)roomCreateContent
- (NSAttributedString*)roomCreatePredecessorAttributedStringWithPredecessorRoomId:(NSString*)predecessorRoomId
{
if (!roomCreateContent)
{
return nil;
}
NSString *predecessorRoomId = roomCreateContent.roomPredecessorInfo.roomId;
NSString *predecessorRoomPermalink = [MXTools permalinkToRoom:predecessorRoomId];
NSDictionary *roomPredecessorReasonAttributes = @{