Update ChatDocumentHandler so RoomManger is no longer required for saving text
Update `ChatDocumentHandler` so `RoomManger` is no longer required for saving the text in the chatbar between room switches. This is achieved by allowing `ChatDocumentHandler` to get the correct `ChatBarChache` itself rather than having to have it passed from `ChatBar.qml`. This avoids any race conditions.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "neochatroom.h"
|
||||
#include "chatbartype.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QMediaMetaData>
|
||||
@@ -1390,6 +1391,20 @@ ChatBarCache *NeoChatRoom::threadCache() const
|
||||
return m_threadCache;
|
||||
}
|
||||
|
||||
ChatBarCache *NeoChatRoom::cacheForType(ChatBarType::Type type) const
|
||||
{
|
||||
switch (type) {
|
||||
case ChatBarType::Room:
|
||||
return m_mainCache;
|
||||
case ChatBarType::Edit:
|
||||
return m_editCache;
|
||||
case ChatBarType::Thread:
|
||||
return m_threadCache;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void NeoChatRoom::replyLastMessage()
|
||||
{
|
||||
const auto &timelineBottom = messageEvents().rbegin();
|
||||
|
||||
Reference in New Issue
Block a user