Fix pending events all showing the same text

The content models were stored in the hasmap under the same key, since they all don't have a valid event id yet.
Store them under their transaction id instead.

BUG: 491277
This commit is contained in:
Tobias Fella
2024-08-06 22:00:27 +02:00
parent 183615fa7b
commit 75e9eee3a9

View File

@@ -444,8 +444,8 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
}
if (role == ContentModelRole) {
if (m_contentModels.contains(evt.id())) {
return QVariant::fromValue<MessageContentModel *>(m_contentModels.at(evt.id()).get());
if (m_contentModels.contains(evt.id().isEmpty() ? evt.transactionId() : evt.id())) {
return QVariant::fromValue<MessageContentModel *>(m_contentModels.at(evt.id().isEmpty() ? evt.transactionId() : evt.id()).get());
}
return {};
}
@@ -621,6 +621,9 @@ void MessageEventModel::createEventObjects(const Quotient::RoomEvent *event)
auto eventId = event->id();
auto senderId = event->senderId();
if (eventId.isEmpty()) {
eventId = event->transactionId();
}
// A pending event might not have a sender ID set yet but in that case it must
// be the local member.
if (senderId.isEmpty()) {