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.
This commit is contained in:
Pascal Precht 2022-08-26 12:18:20 +02:00 committed by Michał Cieślak
parent 7a94479f37
commit 0b5ac614f9
3 changed files with 12 additions and 1 deletions

View File

@ -267,6 +267,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
sender: root.messageDetails.sender sender: root.messageDetails.sender
amISender: root.messageDetails.amISender amISender: root.messageDetails.amISender
messageOriginInfo: root.messageDetails.messageOriginInfo
resendText: root.resendText resendText: root.resendText
showResendButton: root.hasExpired && root.messageDetails.amISender showResendButton: root.hasExpired && root.messageDetails.amISender
onClicked: root.senderNameClicked(sender, mouse) onClicked: root.senderNameClicked(sender, mouse)

View File

@ -13,6 +13,7 @@ QtObject {
property int contentType: 0 property int contentType: 0
property string messageText: "" property string messageText: ""
property string messageContent: "" property string messageContent: ""
property string messageOriginInfo: ""
} }

View File

@ -23,6 +23,7 @@ Item {
property bool isContact: sender.isContact property bool isContact: sender.isContact
property int trustIndicator: sender.trustIndicator property int trustIndicator: sender.trustIndicator
property bool amISender: false property bool amISender: false
property string messageOriginInfo: ""
signal clicked(var sender, var mouse) signal clicked(var sender, var mouse)
signal resendClicked() 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 { StatusContactVerificationIcons {
visible: !root.amISender visible: !root.amISender
isContact: root.isContact isContact: root.isContact
@ -78,7 +87,7 @@ Item {
} }
StatusBaseText { StatusBaseText {
id: tertiaryDetailText id: tertiaryDetailText
visible: !root.amISender visible: !root.amISender && messageOriginInfo == ""
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
font.pixelSize: 10 font.pixelSize: 10
elide: Text.ElideMiddle elide: Text.ElideMiddle