diff --git a/NextcloudTalk/NCChatController.m b/NextcloudTalk/NCChatController.m index eb1ad7ae..bebda5f2 100644 --- a/NextcloudTalk/NCChatController.m +++ b/NextcloudTalk/NCChatController.m @@ -129,14 +129,14 @@ NSString * const NCChatControllerDidReceiveCallEndedMessageNotification NCChatMessage *managedMessage = [NCChatMessage objectsWhere:@"internalId = %@", message.internalId].firstObject; if (managedMessage) { - [NCChatMessage updateChatMessage:managedMessage withChatMessage:message]; + [NCChatMessage updateChatMessage:managedMessage withChatMessage:message isRoomLastMessage:NO]; } else if (message) { [realm addObject:message]; } NCChatMessage *managedParentMessage = [NCChatMessage objectsWhere:@"internalId = %@", parent.internalId].firstObject; if (managedParentMessage) { - [NCChatMessage updateChatMessage:managedParentMessage withChatMessage:parent]; + [NCChatMessage updateChatMessage:managedParentMessage withChatMessage:parent isRoomLastMessage:NO]; } else if (parent) { [realm addObject:parent]; } diff --git a/NextcloudTalk/NCChatMessage.h b/NextcloudTalk/NCChatMessage.h index 6f1d3963..ba45c67d 100644 --- a/NextcloudTalk/NCChatMessage.h +++ b/NextcloudTalk/NCChatMessage.h @@ -66,7 +66,7 @@ RLM_ARRAY_TYPE(NCChatReaction) + (instancetype)messageWithDictionary:(NSDictionary *)messageDict; + (instancetype)messageWithDictionary:(NSDictionary *)messageDict andAccountId:(NSString *)accountId; -+ (void)updateChatMessage:(NCChatMessage *)managedChatMessage withChatMessage:(NCChatMessage *)chatMessage; ++ (void)updateChatMessage:(NCChatMessage *)managedChatMessage withChatMessage:(NCChatMessage *)chatMessage isRoomLastMessage:(BOOL)isRoomLastMessage; - (BOOL)isSystemMessage; - (BOOL)isEmojiMessage; diff --git a/NextcloudTalk/NCChatMessage.m b/NextcloudTalk/NCChatMessage.m index 1406f36c..1d81f693 100644 --- a/NextcloudTalk/NCChatMessage.m +++ b/NextcloudTalk/NCChatMessage.m @@ -126,7 +126,7 @@ NSString * const kMessageTypeVoiceMessage = @"voice-message"; return message; } -+ (void)updateChatMessage:(NCChatMessage *)managedChatMessage withChatMessage:(NCChatMessage *)chatMessage ++ (void)updateChatMessage:(NCChatMessage *)managedChatMessage withChatMessage:(NCChatMessage *)chatMessage isRoomLastMessage:(BOOL)isRoomLastMessage { managedChatMessage.actorDisplayName = chatMessage.actorDisplayName; managedChatMessage.actorId = chatMessage.actorId; @@ -138,7 +138,10 @@ NSString * const kMessageTypeVoiceMessage = @"voice-message"; managedChatMessage.isReplyable = chatMessage.isReplyable; managedChatMessage.messageType = chatMessage.messageType; managedChatMessage.reactionsJSONString = chatMessage.reactionsJSONString; - managedChatMessage.reactionsSelfJSONString = chatMessage.reactionsSelfJSONString; + + if (!isRoomLastMessage) { + managedChatMessage.reactionsSelfJSONString = chatMessage.reactionsSelfJSONString; + } if (!managedChatMessage.parentId && chatMessage.parentId) { managedChatMessage.parentId = chatMessage.parentId; diff --git a/NextcloudTalk/NCRoomsManager.m b/NextcloudTalk/NCRoomsManager.m index 7ad484a6..b8eaea18 100644 --- a/NextcloudTalk/NCRoomsManager.m +++ b/NextcloudTalk/NCRoomsManager.m @@ -441,7 +441,7 @@ NSString * const NCRoomsManagerDidReceiveChatMessagesNotification = @"ChatMess NCChatMessage *managedLastMessage = [NCChatMessage objectsWhere:@"internalId = %@", lastMessage.internalId].firstObject; if (managedLastMessage) { - [NCChatMessage updateChatMessage:managedLastMessage withChatMessage:lastMessage]; + [NCChatMessage updateChatMessage:managedLastMessage withChatMessage:lastMessage isRoomLastMessage:YES]; } else if (lastMessage) { NCChatController *chatController = [[NCChatController alloc] initForRoom:room]; [chatController storeMessages:@[messageDict] withRealm:realm];