This is that bug that causes reply colors to be white, and this error to print in the log: qrc:/qt/qml/org/kde/neochat/messagecontent/ReplyComponent.qml:41: TypeError: Cannot read property 'color' of null The reason why this happens is inside of EventMessageContentModel, it needs to be able to find the relevant event in the room to fetch the room member (and then their color.) Dependent on many variables to align, this can happen easily if you are faster than your server giving you said events. But this is an easy fix, we obviously get the event afterwards and just need to re-evaluate the the author property. I also made sure it falls back to some color instead of white, which will also quiet the error.
71 lines
2.1 KiB
QML
71 lines
2.1 KiB
QML
// SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org>
|
|
// SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls as QQC2
|
|
import QtQuick.Layouts
|
|
import Qt.labs.qmlmodels
|
|
|
|
import org.kde.coreaddons
|
|
import org.kde.kirigami as Kirigami
|
|
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|
|
|
import org.kde.neochat
|
|
|
|
/**
|
|
* @brief A component to show a message that has been replied to.
|
|
*
|
|
* Similar to the main timeline delegate a reply delegate is chosen based on the type
|
|
* of message being replied to. The main difference is that not all messages can be
|
|
* show in their original form and are instead visualised with a MIME type delegate
|
|
* e.g. Videos.
|
|
*/
|
|
RowLayout {
|
|
id: root
|
|
|
|
/**
|
|
* @brief The model to visualise the content of the message replied to.
|
|
*/
|
|
required property var replyContentModel
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: Kirigami.Units.largeSpacing
|
|
|
|
Rectangle {
|
|
id: verticalBorder
|
|
Layout.fillHeight: true
|
|
|
|
implicitWidth: Kirigami.Units.smallSpacing
|
|
color: root.replyContentModel.author?.color ?? Kirigami.Theme.highlightColor
|
|
radius: Kirigami.Units.cornerRadius
|
|
}
|
|
ColumnLayout {
|
|
id: contentColumn
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
Message.maxContentWidth: _private.availableContentWidth
|
|
|
|
Repeater {
|
|
id: contentRepeater
|
|
model: root.replyContentModel
|
|
delegate: ReplyMessageComponentChooser {
|
|
onReplyClicked: RoomManager.goToEvent(root.replyContentModel.eventId)
|
|
}
|
|
}
|
|
}
|
|
HoverHandler {
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
TapHandler {
|
|
acceptedButtons: Qt.LeftButton
|
|
onTapped: RoomManager.goToEvent(root.replyContentModel.eventId)
|
|
}
|
|
QtObject {
|
|
id: _private
|
|
// The space available for the component after taking away the border
|
|
readonly property real availableContentWidth: root.Message.maxContentWidth - verticalBorder.implicitWidth - root.spacing
|
|
}
|
|
}
|