From 780ade987d9c1c1c79c5e546d22df51e97752997 Mon Sep 17 00:00:00 2001 From: Pascal Precht <445106+PascalPrecht@users.noreply.github.com> Date: Fri, 26 Aug 2022 12:18:20 +0200 Subject: [PATCH] feat(StatusMessage): add `messageOriginInfo` property This is a property that allows for adding information about the origin of a message (e.g. "Imported from discord"). This will most likely be only useful for messages that have been imported from any other platform. Because importing from other platforms requires those message to be signed by a Status Account, it's undesirable to render the public key of the account that signed imported messages. Hence, when there's a `messageOriginInfo`, we don't render the elided public key. --- src/StatusQ/Components/StatusMessage.qml | 1 + src/StatusQ/Components/StatusMessageDetails.qml | 1 + .../private/statusMessage/StatusMessageHeader.qml | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/StatusQ/Components/StatusMessage.qml b/src/StatusQ/Components/StatusMessage.qml index 2f780f6e..0ad91935 100644 --- a/src/StatusQ/Components/StatusMessage.qml +++ b/src/StatusQ/Components/StatusMessage.qml @@ -267,6 +267,7 @@ Rectangle { Layout.fillWidth: true sender: root.messageDetails.sender amISender: root.messageDetails.amISender + messageOriginInfo: root.messageDetails.messageOriginInfo resendText: root.resendText showResendButton: root.hasExpired && root.messageDetails.amISender onClicked: root.senderNameClicked(sender, mouse) diff --git a/src/StatusQ/Components/StatusMessageDetails.qml b/src/StatusQ/Components/StatusMessageDetails.qml index df1cf5e5..246308e9 100644 --- a/src/StatusQ/Components/StatusMessageDetails.qml +++ b/src/StatusQ/Components/StatusMessageDetails.qml @@ -13,6 +13,7 @@ QtObject { property int contentType: 0 property string messageText: "" property string messageContent: "" + property string messageOriginInfo: "" } diff --git a/src/StatusQ/Components/private/statusMessage/StatusMessageHeader.qml b/src/StatusQ/Components/private/statusMessage/StatusMessageHeader.qml index bede3c8b..2af8e27a 100644 --- a/src/StatusQ/Components/private/statusMessage/StatusMessageHeader.qml +++ b/src/StatusQ/Components/private/statusMessage/StatusMessageHeader.qml @@ -23,6 +23,7 @@ Item { property bool isContact: sender.isContact property int trustIndicator: sender.trustIndicator property bool amISender: false + property string messageOriginInfo: "" signal clicked(var sender, var mouse) signal resendClicked() @@ -56,6 +57,14 @@ Item { } } } + StatusBaseText { + id: messageOriginInfo + Layout.alignment: Qt.AlignVCenter + visible: root.messageOriginInfo !== "" + color: Theme.palette.baseColor1 + font.pixelSize: 10 + text: root.messageOriginInfo + } StatusContactVerificationIcons { visible: !root.amISender isContact: root.isContact @@ -78,7 +87,7 @@ Item { } StatusBaseText { id: tertiaryDetailText - visible: !root.amISender + visible: !root.amISender && messageOriginInfo == "" Layout.alignment: Qt.AlignVCenter font.pixelSize: 10 elide: Text.ElideMiddle