Current Room Messages

Make sure that message delegates are getting the room object directly rather than requiring the assumption that currentRoom is declared somewhere higher up.
This commit is contained in:
James Graham
2024-01-15 19:47:50 +00:00
parent f1efc1f17d
commit 85cda8ffa7
13 changed files with 41 additions and 45 deletions

View File

@@ -29,6 +29,11 @@ import org.kde.neochat.config
TimelineDelegate {
id: root
/**
* @brief The NeoChatRoom the delegate is being displayed in.
*/
required property NeoChatRoom room
/**
* @brief The index of the delegate in the model.
*/
@@ -244,8 +249,6 @@ TimelineDelegate {
*/
readonly property alias hovered: bubble.hovered
required property NeoChatConnection connection
/**
* @brief Open the context menu for the message.
*/
@@ -326,7 +329,7 @@ TimelineDelegate {
Component.onCompleted: {
if (root.isReply && root.replyDelegateType === DelegateType.Other) {
currentRoom.loadReply(root.eventId, root.replyId)
root.room.loadReply(root.eventId, root.replyId)
}
}
@@ -437,7 +440,7 @@ TimelineDelegate {
visible: root.showReactions
model: root.reaction
onReactionClicked: (reaction) => currentRoom.toggleReaction(root.eventId, reaction)
onReactionClicked: (reaction) => root.room.toggleReaction(root.eventId, reaction)
}
AvatarFlow {
Layout.alignment: Qt.AlignRight