From d7f91208408fbba17431a53a310284e2a87ee78c Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Sat, 13 Jun 2020 15:02:48 -0400 Subject: [PATCH] Adding messageId to messages --- src/app/chat/views/message_list.nim | 7 +++++-- ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/chat/views/message_list.nim b/src/app/chat/views/message_list.nim index 96d67efe76..7c1ecb4413 100644 --- a/src/app/chat/views/message_list.nim +++ b/src/app/chat/views/message_list.nim @@ -15,6 +15,7 @@ type Clock = UserRole + 9 ChatId = UserRole + 10 SectionIdentifier = UserRole + 11 + Id = UserRole + 12 QtObject: type @@ -68,7 +69,7 @@ QtObject: of ChatMessageRoles.FromAuthor: result = newQVariant(message.fromAuthor) of ChatMessageRoles.ChatId: result = newQVariant(message.chatId) of ChatMessageRoles.SectionIdentifier: result = newQVariant(sectionIdentifier(message)) - + of ChatMessageRoles.Id: result = newQVariant(message.id) method roleNames(self: ChatMessageList): Table[int, string] = { @@ -82,7 +83,9 @@ QtObject: ChatMessageRoles.Sticker.int:"sticker", ChatMessageRoles.FromAuthor.int:"fromAuthor", ChatMessageRoles.ChatId.int:"chatId", - ChatMessageRoles.SectionIdentifier.int: "sectionIdentifier" + ChatMessageRoles.SectionIdentifier.int: "sectionIdentifier", + ChatMessageRoles.Id.int: "messageId" + }.toTable proc add*(self: ChatMessageList, message: Message) = diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml index fae8b0b511..7c097c4dd7 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml @@ -67,7 +67,7 @@ ScrollView { DelegateModel { id: messageListDelegate property var lessThan: [ - function(left, right) { return left.clock < right.clock } + function(left, right) { return left.clock < right.clock } // TODO: should be sorted by messageId ] property int sortOrder: 0