fix(reply): fix reply image displaying the current user

Fixes #4185
This commit is contained in:
Jonathan Rainville 2021-11-26 10:08:36 -05:00
parent 2d49da7331
commit 4d7d2261aa
5 changed files with 31 additions and 18 deletions

View File

@ -79,16 +79,16 @@ QtObject {
property bool isStatusUpdate: false
property int statusAgeEpoch: 0
property int replyMessageIndex: chatsModel.messageView.messageList.getMessageIndex(responseTo);
property string repliedMessageAuthor: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "userName") : "";
property string repliedMessageAuthorPubkey: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "publicKey") : "";
property bool repliedMessageAuthorIsCurrentUser: replyMessageIndex > -1 ? repliedMessageAuthorPubkey === userProfile.pubKey : "";
property bool repliedMessageIsEdited: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "isEdited") === "true" : false;
property string repliedMessageContent: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "message") : "";
property int repliedMessageType: replyMessageIndex > -1 ? parseInt(chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "contentType")) : 0;
property string repliedMessageImage: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "image") : "";
property string repliedMessageUserIdenticon: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "identicon") : "";
property string repliedMessageUserImage: replyMessageIndex > -1 ? appMain.getProfileImage(repliedMessageAuthorPubkey, repliedMessageAuthorIsCurrentUser , false) || "" : "";
// property int replyMessageIndex: chatsModel.messageView.messageList.getMessageIndex(responseTo);
// property string repliedMessageAuthor: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "userName") : "";
// property string repliedMessageAuthorPubkey: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "publicKey") : "";
// property bool repliedMessageAuthorIsCurrentUser: replyMessageIndex > -1 ? repliedMessageAuthorPubkey === userProfile.pubKey : "";
// property bool repliedMessageIsEdited: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "isEdited") === "true" : false;
// property string repliedMessageContent: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "message") : "";
// property int repliedMessageType: replyMessageIndex > -1 ? parseInt(chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "contentType")) : 0;
// property string repliedMessageImage: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "image") : "";
// property string repliedMessageUserIdenticon: replyMessageIndex > -1 ? chatsModel.messageView.messageList.getMessageData(replyMessageIndex, "identicon") : "";
// property string repliedMessageUserImage: replyMessageIndex > -1 ? appMain.getProfileImage(repliedMessageAuthorPubkey, repliedMessageAuthorIsCurrentUser , false) || "" : "";
property var imageClick: function () {}
property var scrollToBottom: function () {}

View File

@ -10,8 +10,8 @@ Loader {
height: active ? item.height : 0
property int imageHeight: 36
property int imageWidth: 36
// property string profileImage: ""
// property string identiconImageSource: ""
property string profileImage: ""
property string identiconImageSource: ""
property bool isReplyImage: false
// property var messageContextMenu
// property bool isCurrentUser: false
@ -31,6 +31,14 @@ Loader {
border.width: 1
border.color: Style.current.border
source: {
if (root.isReplyImage) {
if (root.profileImage) {
return root.profileImage
}
if (root.identiconImageSource) {
return root.identiconImageSource
}
}
if (profileImageSource) {
return profileImageSource
}

View File

@ -27,9 +27,9 @@ Loader {
// property bool isCurrentUser: false
// property int repliedMessageType
// property string repliedMessageImage
// property string repliedMessageUserIdenticon
property string repliedMessageUserIdenticon: ""
// property bool repliedMessageIsEdited
// property string repliedMessageUserImage
property string repliedMessageUserImage: ""
// property string repliedMessageAuthor
// property string repliedMessageContent
// property string responseTo: ""
@ -107,9 +107,9 @@ Loader {
active: true
anchors.left: replyCorner.right
anchors.leftMargin: Style.current.halfPadding
// identiconImageSource: repliedMessageUserIdenticon
identiconImageSource: repliedMessageUserIdenticon
isReplyImage: true
// profileImage: repliedMessageUserImage
profileImage: repliedMessageUserImage
// isCurrentUser: isCurrentUser
onClickMessage: {
root.clickMessage(true, false, false, null, false, false, isReplyImage)

View File

@ -40,6 +40,9 @@ Item {
return false;
}
}
property string repliedMessageUserIdenticon
property string repliedMessageUserImage
property bool showEdit: true
property var messageContextMenu
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker)
@ -243,9 +246,9 @@ Item {
// isCurrentUser: root.messageStore.isCurrentUser
// repliedMessageType: root.messageStore.repliedMessageType
// repliedMessageImage: root.messageStore.repliedMessageImage
// repliedMessageUserIdenticon: root.messageStore.repliedMessageUserIdenticon
repliedMessageUserIdenticon: root.repliedMessageUserIdenticon
// repliedMessageIsEdited: root.messageStore.repliedMessageIsEdited
// repliedMessageUserImage: root.messageStore.repliedMessageUserImage
repliedMessageUserImage: root.repliedMessageUserImage
// repliedMessageAuthor: root.messageStore.repliedMessageAuthor
// repliedMessageContent: root.messageStore.repliedMessageContent
// responseTo: root.messageStore.responseTo

View File

@ -368,6 +368,8 @@ Column {
messageContextMenu: root.messageContextMenu
store: root.rootStore
messageStore: root.messageStore
repliedMessageUserIdenticon: root.repliedMessageUserIdenticon
repliedMessageUserImage: root.repliedMessageUserImage
onAddEmoji: {
root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker);
}