Move the storage of thread models to the room
This commit is contained in:
@@ -174,6 +174,7 @@ void NeoChatRoom::setVisible(bool visible)
|
||||
if (!visible) {
|
||||
m_memberObjects.clear();
|
||||
m_eventContentModels.clear();
|
||||
m_threadModels.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1797,4 +1798,17 @@ MessageContentModel *NeoChatRoom::contentModelForEvent(const QString &evtOrTxnId
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ThreadModel *NeoChatRoom::modelForThread(const QString &threadRootId)
|
||||
{
|
||||
if (threadRootId.isEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!m_threadModels.contains(threadRootId)) {
|
||||
return m_threadModels.emplace(threadRootId, std::make_unique<ThreadModel>(threadRootId, this)).first->second.get();
|
||||
}
|
||||
|
||||
return m_threadModels[threadRootId].get();
|
||||
}
|
||||
|
||||
#include "moc_neochatroom.cpp"
|
||||
|
||||
Reference in New Issue
Block a user