Adding messageId to messages

This commit is contained in:
Richard Ramos 2020-06-13 15:02:48 -04:00 committed by Iuri Matias
parent 9ef575dc30
commit d7f9120840
2 changed files with 6 additions and 3 deletions

View File

@ -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) =

View File

@ -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