Fix pending events not showing when the server event turns up
This commit is contained in:
committed by
Tobias Fella
parent
776807580a
commit
149013d2ff
@@ -80,7 +80,7 @@ void MessageContentModel::initializeModel()
|
|||||||
|
|
||||||
connect(m_room, &NeoChatRoom::pendingEventAboutToMerge, this, [this](Quotient::RoomEvent *serverEvent) {
|
connect(m_room, &NeoChatRoom::pendingEventAboutToMerge, this, [this](Quotient::RoomEvent *serverEvent) {
|
||||||
if (m_room != nullptr && m_event != nullptr) {
|
if (m_room != nullptr && m_event != nullptr) {
|
||||||
if (m_eventId == serverEvent->id()) {
|
if (m_eventId == serverEvent->id() || m_eventId == serverEvent->transactionId()) {
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_isPending = false;
|
m_isPending = false;
|
||||||
intiializeEvent(serverEvent);
|
intiializeEvent(serverEvent);
|
||||||
|
|||||||
@@ -444,8 +444,14 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (role == ContentModelRole) {
|
if (role == ContentModelRole) {
|
||||||
if (m_contentModels.contains(evt.id().isEmpty() ? evt.transactionId() : evt.id())) {
|
QString modelId;
|
||||||
return QVariant::fromValue<MessageContentModel *>(m_contentModels.at(evt.id().isEmpty() ? evt.transactionId() : evt.id()).get());
|
if (!evt.id().isEmpty() && m_contentModels.contains(evt.id())) {
|
||||||
|
modelId = evt.id();
|
||||||
|
} else if (!evt.transactionId().isEmpty() && m_contentModels.contains(evt.transactionId())) {
|
||||||
|
modelId = evt.transactionId();
|
||||||
|
}
|
||||||
|
if (!modelId.isEmpty()) {
|
||||||
|
return QVariant::fromValue<MessageContentModel *>(m_contentModels.at(modelId).get());
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -634,7 +640,7 @@ void MessageEventModel::createEventObjects(const Quotient::RoomEvent *event)
|
|||||||
m_memberObjects[senderId] = std::unique_ptr<NeochatRoomMember>(new NeochatRoomMember(m_currentRoom, senderId));
|
m_memberObjects[senderId] = std::unique_ptr<NeochatRoomMember>(new NeochatRoomMember(m_currentRoom, senderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_contentModels.contains(eventId)) {
|
if (!m_contentModels.contains(eventId) && !m_contentModels.contains(event->transactionId())) {
|
||||||
if (!event->isStateEvent() || event->matrixType() == QStringLiteral("org.matrix.msc3672.beacon_info")) {
|
if (!event->isStateEvent() || event->matrixType() == QStringLiteral("org.matrix.msc3672.beacon_info")) {
|
||||||
m_contentModels[eventId] = std::unique_ptr<MessageContentModel>(new MessageContentModel(m_currentRoom, event));
|
m_contentModels[eventId] = std::unique_ptr<MessageContentModel>(new MessageContentModel(m_currentRoom, event));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user