fix(@chat): only show reaction to emoji right click

fixes #5764
This commit is contained in:
Anthony Laibe 2022-05-17 12:40:27 +02:00 committed by Anthony Laibe
parent fdb1f375ab
commit c673f8302a
6 changed files with 35 additions and 33 deletions

View File

@ -131,7 +131,7 @@ QtObject {
return []
}
}
property var clickMessage: function(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false, hideEmojiPicker = false, isReply = false, isRightClickOnImage = false, imageSource = "") {
property var clickMessage: function(isProfileClick, isSticker = false, isImage = false, image = null, isEmoji = false, hideEmojiPicker = false, isReply = false, isRightClickOnImage = false, imageSource = "") {
if (placeholderMessage || activityCenterMessage) {
return
}
@ -147,7 +147,7 @@ QtObject {
messageContextMenu.isCurrentUser = isCurrentUser
messageContextMenu.isText = isText
messageContextMenu.isSticker = isSticker;
messageContextMenu.emojiOnly = emojiOnly;
messageContextMenu.isEmoji = isEmoji;
messageContextMenu.hideEmojiPicker = hideEmojiPicker;
messageContextMenu.pinnedMessage = pinnedMessage;
messageContextMenu.isCurrentUser = isCurrentUser;

View File

@ -23,7 +23,7 @@ Rectangle {
signal replyClicked(string messageId, string author)
signal hoverChanged(bool hovered)
signal setMessageActive(string messageId, bool active)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker)
visible: !buttonsContainer.isChatBlocked &&
!buttonsContainer.placeholderMsg && !buttonsContainer.activityCenterMsg &&

View File

@ -34,7 +34,7 @@ Loader {
property int chatHorizontalPadding
property string stickerData
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker, bool isReply)
signal scrollToBottom(bool isit, var container)
sourceComponent: Component {

View File

@ -67,11 +67,21 @@ Item {
property var transactionParams
signal openStickerPackPopup(string stickerPackId)
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource)
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool isEmoji, bool hideEmojiPicker)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource)
signal replyClicked(string messageId, string author)
signal imageClicked(var image)
function setMessageActive(messageId, active) {
if (active) {
activeMessage = messageId;
} else if (activeMessage === messageId) {
activeMessage = "";
}
}
width: parent.width
height: messageContainer.height + messageContainer.anchors.topMargin
+ (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0)
@ -104,7 +114,7 @@ Item {
isActivityCenterMessage: activityCenterMessage
stickersLoaded: root.stickersLoaded
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, null, false, false, false, false, "");
root.clickMessage(isProfileClick, isSticker, isImage, null, isEmoji, false, false, false, "");
}
}
@ -128,7 +138,7 @@ Item {
activityCenterMsg: activityCenterMessage
placeholderMsg: placeholderMessage
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, false, false, "");
root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, false, false, "");
}
onReplyClicked: {
root.replyClicked(messageId, author)
@ -141,7 +151,7 @@ Item {
Connections {
enabled: isMessageActive
target: root.messageContextMenu
onClosed: setMessageActive(messageId, false)
onClosed: root.setMessageActive(messageId, false)
}
}
}
@ -322,7 +332,7 @@ Item {
}
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, false, "")
root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, isReply, false, "")
}
}
@ -600,7 +610,7 @@ Item {
}
onSetMessageActive: {
setMessageActive(messageId, active);
root.setMessageActive(messageId, active);
}
}
@ -749,7 +759,7 @@ Item {
}
onSetMessageActive: {
setMessageActive(messageId, active);;
root.setMessageActive(messageId, active);
}
}
}

View File

@ -41,7 +41,7 @@ StatusPopupMenu {
property bool isRightClickOnImage: false
property bool pinnedPopup: false
property bool isDebugEnabled: false
property bool emojiOnly: false
property bool isEmoji: false
property bool hideEmojiPicker: true
property bool pinnedMessage: false
property bool canPin: false
@ -83,7 +83,7 @@ StatusPopupMenu {
/* // copy link feature not ready yet
const numLinkUrls = root.linkUrls.split(" ").length
copyLinkMenu.enabled = numLinkUrls > 1
copyLinkAction.enabled = !!root.linkUrls && numLinkUrls === 1 && !emojiOnly && !root.isProfile
copyLinkAction.enabled = !!root.linkUrls && numLinkUrls === 1 && !isEmoji && !root.isProfile
*/
popup()
}
@ -92,13 +92,13 @@ StatusPopupMenu {
id: emojiContainer
width: emojiRow.width
height: visible ? emojiRow.height : 0
visible: !root.hideEmojiPicker && (root.emojiOnly || !root.isProfile) && !root.pinnedPopup
visible: !root.hideEmojiPicker && (root.isEmoji || !root.isProfile) && !root.pinnedPopup
Row {
id: emojiRow
spacing: Style.current.halfPadding
leftPadding: Style.current.halfPadding
rightPadding: Style.current.halfPadding
bottomPadding: root.emojiOnly ? 0 : Style.current.padding
bottomPadding: root.isEmoji ? 0 : Style.current.padding
Repeater {
model: root.reactionModel
@ -131,7 +131,7 @@ StatusPopupMenu {
Separator {
anchors.bottom: viewProfileAction.top
visible: !root.emojiOnly && !root.hideEmojiPicker && !pinnedPopup
visible: !root.isEmoji && !root.hideEmojiPicker && !pinnedPopup
}
StatusMenuItem {
@ -188,7 +188,7 @@ StatusPopupMenu {
icon.name: "chat"
enabled: root.isProfile && root.store.contactsStore.isMyMutualContact(root.selectedUserPublicKey) ||
(!root.hideEmojiPicker &&
!root.emojiOnly &&
!root.isEmoji &&
!root.isProfile &&
!root.pinnedPopup &&
!root.isRightClickOnImage)
@ -204,7 +204,7 @@ StatusPopupMenu {
icon.name: "edit"
enabled: root.isMyMessage &&
!root.hideEmojiPicker &&
!root.emojiOnly &&
!root.isEmoji &&
!root.isProfile &&
!root.pinnedPopup &&
!root.isRightClickOnImage
@ -248,7 +248,7 @@ StatusPopupMenu {
}
icon.name: "pin"
enabled: {
if(root.isProfile || root.emojiOnly || root.isRightClickOnImage)
if(root.isProfile || root.isEmoji || root.isRightClickOnImage)
return false
switch (root.chatType) {
@ -280,7 +280,7 @@ StatusPopupMenu {
id: deleteMessageAction
enabled: root.isMyMessage &&
!root.isProfile &&
!root.emojiOnly &&
!root.isEmoji &&
!root.pinnedPopup &&
!root.isRightClickOnImage &&
(root.messageContentType === Constants.messageContentType.messageType ||

View File

@ -83,14 +83,6 @@ Column {
}
}
function setMessageActive(messageId, active) {
if (active) {
activeMessage = messageId;
} else if (activeMessage === messageId) {
activeMessage = "";
}
}
// Legacy
property string responseTo: responseToMessageWithId
property bool isCurrentUser: amISender
@ -159,7 +151,7 @@ Column {
isSticker = false,
isImage = false,
image = null,
emojiOnly = false,
isEmoji = false,
hideEmojiPicker = false,
isReply = false,
isRightClickOnImage = false,
@ -187,7 +179,7 @@ Column {
messageContextMenu.isProfile = !!isProfileClick
messageContextMenu.isRightClickOnImage = isRightClickOnImage
messageContextMenu.emojiOnly = emojiOnly
messageContextMenu.isEmoji = isEmoji
messageContextMenu.hideEmojiPicker = hideEmojiPicker
if(isReply){
@ -363,11 +355,11 @@ Column {
transactionParams: root.transactionParams
onAddEmoji: {
root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker)
root.clickMessage(isProfileClick, isSticker, isImage , image, isEmoji, hideEmojiPicker)
}
onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, isRightClickOnImage, imageSource)
root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, isReply, isRightClickOnImage, imageSource)
}
onOpenStickerPackPopup: {