fix(@desktop/chat-messages): [base_bc] emojis alignment is wrong

Fixes #4561
This commit is contained in:
Sale Djenic 2022-01-25 12:39:50 +01:00
parent 518b7e455e
commit 6a81b97012
1 changed files with 24 additions and 8 deletions

View File

@ -32,7 +32,10 @@ Item {
property bool isCurrentUser: false property bool isCurrentUser: false
property bool isHovered: false property bool isHovered: false
property bool showMoreButton: { property bool showMoreButton: {
let chatTypeThisMessageBelongsTo = messageStore.getChatType() if(!root.messageStore)
return false
let chatTypeThisMessageBelongsTo = root.messageStore.getChatType()
switch (chatTypeThisMessageBelongsTo) { switch (chatTypeThisMessageBelongsTo) {
case Constants.chatType.oneToOne: case Constants.chatType.oneToOne:
return true return true
@ -162,9 +165,10 @@ Item {
} }
Rectangle { Rectangle {
property alias chatText: chatText
id: messageContainer id: messageContainer
property alias messageContent: messageContent
anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top
anchors.topMargin: dateGroupLbl.visible ? (activityCenterMessage ? 4 : Style.current.padding) : 0 anchors.topMargin: dateGroupLbl.visible ? (activityCenterMessage ? 4 : Style.current.padding) : 0
height: childrenRect.height height: childrenRect.height
@ -267,7 +271,9 @@ Item {
active: responseTo !== "" && !activityCenterMessage active: responseTo !== "" && !activityCenterMessage
Component.onCompleted: { Component.onCompleted: {
let obj = messageStore.getMessageByIdAsJson(responseTo) if(!root.messageStore)
return
let obj = root.messageStore.getMessageByIdAsJson(responseTo)
if(!obj) if(!obj)
return return
@ -541,7 +547,9 @@ Item {
contentType: root.contentType contentType: root.contentType
stickerData: root.sticker stickerData: root.sticker
onLoaded: { onLoaded: {
messageStore.scrollToBottom(true, root.container) if(!root.messageStore)
return
root.messageStore.scrollToBottom(true, root.container)
} }
} }
} }
@ -678,12 +686,12 @@ Item {
anchors.bottom: messageContainer.bottom anchors.bottom: messageContainer.bottom
anchors.bottomMargin: Style.current.halfPadding anchors.bottomMargin: Style.current.halfPadding
anchors.left: messageContainer.left anchors.left: messageContainer.left
anchors.leftMargin: messageContainer.chatText.textField.leftPadding anchors.leftMargin: messageContainer.messageContent.anchors.leftMargin
sourceComponent: Component { sourceComponent: Component {
EmojiReactionsPanel { EmojiReactionsPanel {
id: emojiRect id: emojiRect
store: messageStore store: root.messageStore
emojiReactionsModel: reactionsModel emojiReactionsModel: reactionsModel
onHoverChanged: { onHoverChanged: {
setHovered(messageId, hovered) setHovered(messageId, hovered)
@ -698,7 +706,15 @@ Item {
root.messageContextMenu.setYPosition = function() { return (-root.messageContextMenu.height - 4)} root.messageContextMenu.setYPosition = function() { return (-root.messageContextMenu.height - 4)}
} }
onToggleReaction: messageStore.toggleReaction(messageId, emojiID) onToggleReaction: {
if(!root.messageStore)
{
console.error("reaction cannot be toggled, message store is not valid")
return
}
root.messageStore.toggleReaction(messageId, emojiID)
}
onSetMessageActive: { onSetMessageActive: {
setMessageActive(messageId, active);; setMessageActive(messageId, active);;