fix: group chat colors and adding nbsp; only when the message is from the current user

This commit is contained in:
Richard Ramos 2020-08-11 11:27:05 -04:00 committed by Iuri Matias
parent 246b90b5ae
commit 9b35a01103
2 changed files with 9 additions and 2 deletions

View File

@ -100,6 +100,11 @@ QtObject:
for chat in self.chats:
if chat.id == chatId:
return chat
proc getChannelByName*(self: ChannelsList, name: string): Chat =
for chat in self.chats:
if chat.name == name:
return chat
proc upsertChannel(self: ChannelsList, channel: Chat): int =
let idx = self.chats.findIndexById(channel.id)
@ -114,7 +119,7 @@ QtObject:
result = idx
proc getChannelColor*(self: ChannelsList, name: string): string =
let channel = self.getChannelById(name)
let channel = self.getChannelByName(name)
if (channel == nil): return
return channel.color

View File

@ -29,7 +29,9 @@ proc renderBlock(self: ChatMessageList, message: Message): string =
for pMsg in message.parsedText:
case pMsg.textType:
of "paragraph":
result = result & "<p>&nbsp;"
result = result & "<p>"
if message.isCurrentUser:
result = result & "&nbsp;"
for children in pMsg.children:
result = result & self.renderInline(children)
result = result & "</p>"