diff --git a/qml/components/MessageListViewItemSimple.qml b/qml/components/MessageListViewItemSimple.qml index 12747bb..c893488 100644 --- a/qml/components/MessageListViewItemSimple.qml +++ b/qml/components/MessageListViewItemSimple.qml @@ -24,8 +24,9 @@ import "../js/functions.js" as Functions Item { id: messageListItem property var myMessage: display - property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender.user_id) - property bool isOwnMessage: chatPage.myUserId === myMessage.sender.user_id + property bool senderIsUser: myMessage.sender["@type"] === "messageSenderUser" + property var userInformation: senderIsUser ? tdLibWrapper.getUserInformation(myMessage.sender.user_id) : null + property bool isOwnMessage: senderIsUser && chatPage.myUserId === myMessage.sender.user_id height: backgroundRectangle.height + Theme.paddingMedium Rectangle { @@ -43,7 +44,10 @@ Item { color: Theme.highlightColor horizontalAlignment: Text.AlignHCenter font.pixelSize: Theme.fontSizeExtraSmall - text: "" + (!messageListItem.isOwnMessage ? Emoji.emojify(Functions.getUserName(messageListItem.userInformation), font.pixelSize) : qsTr("You")) + " " + Emoji.emojify(Functions.getMessageText(messageListItem.myMessage, false, chatPage.myUserId, false), font.pixelSize) + text: (messageListItem.senderIsUser + ? "" + (!messageListItem.isOwnMessage ? Emoji.emojify(Functions.getUserName(messageListItem.userInformation), font.pixelSize) : qsTr("You")) + " " + : "" + Emoji.emojify(chatPage.chatInformation.title || "") + " ") + + Emoji.emojify(Functions.getMessageText(messageListItem.myMessage, false, chatPage.myUserId, false), font.pixelSize) textFormat: Text.RichText wrapMode: Text.WrapAtWordBoundaryOrAnywhere onLinkActivated: {