Display Chat title in SimpleMessageDelegate if sender is chat
On overviewPage I found it sufficient being empty, since the title is directly above it, anyway. But in the channel itself it looked wrong without a user name. The name link doesn't have a href – this would only be useful for edge cases like someone sharing a "changed title" message to another chat. I did not consider that relevant enough.
This commit is contained in:
parent
3abdbe6a58
commit
2f11b6c67c
1 changed files with 7 additions and 3 deletions
|
@ -24,8 +24,9 @@ import "../js/functions.js" as Functions
|
||||||
Item {
|
Item {
|
||||||
id: messageListItem
|
id: messageListItem
|
||||||
property var myMessage: display
|
property var myMessage: display
|
||||||
property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender.user_id)
|
property bool senderIsUser: myMessage.sender["@type"] === "messageSenderUser"
|
||||||
property bool isOwnMessage: chatPage.myUserId === myMessage.sender.user_id
|
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
|
height: backgroundRectangle.height + Theme.paddingMedium
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -43,7 +44,10 @@ Item {
|
||||||
color: Theme.highlightColor
|
color: Theme.highlightColor
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
text: "<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.primaryColor+"\" href=\"userId://" + messageListItem.userInformation.id + "\">" + (!messageListItem.isOwnMessage ? Emoji.emojify(Functions.getUserName(messageListItem.userInformation), font.pixelSize) : qsTr("You")) + "</a> " + Emoji.emojify(Functions.getMessageText(messageListItem.myMessage, false, chatPage.myUserId, false), font.pixelSize)
|
text: (messageListItem.senderIsUser
|
||||||
|
? "<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.primaryColor+"\" href=\"userId://" + messageListItem.userInformation.id + "\">" + (!messageListItem.isOwnMessage ? Emoji.emojify(Functions.getUserName(messageListItem.userInformation), font.pixelSize) : qsTr("You")) + "</a> "
|
||||||
|
: "<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.secondaryHighlightColor+"\">" + Emoji.emojify(chatPage.chatInformation.title || "") + "</a> ")
|
||||||
|
+ Emoji.emojify(Functions.getMessageText(messageListItem.myMessage, false, chatPage.myUserId, false), font.pixelSize)
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
|
|
Loading…
Reference in a new issue