Give NeoChatRoom the hidden filter for last event cache

Otherwise we keep state events and other unwanted events in the cache
(if the user turned these off.)
This commit is contained in:
Joshua Goins
2025-05-24 14:04:37 -04:00
parent 2f87b1f398
commit a0e8039d92
3 changed files with 14 additions and 1 deletions

View File

@@ -59,6 +59,10 @@
using namespace Quotient;
std::function<bool(const Quotient::RoomEvent *)> NeoChatRoom::m_hiddenFilter = [](const Quotient::RoomEvent *) -> bool {
return false;
};
NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState)
: Room(connection, std::move(roomId), joinState)
{
@@ -369,7 +373,7 @@ const RoomEvent *NeoChatRoom::lastEvent(std::function<bool(const RoomEvent *)> f
void NeoChatRoom::cacheLastEvent()
{
auto event = lastEvent();
auto event = lastEvent(m_hiddenFilter);
if (event != nullptr) {
auto &roomLastMessageProvider = RoomLastMessageProvider::self();
@@ -1718,4 +1722,9 @@ QString NeoChatRoom::rootIdForThread(const QString &eventId) const
return rootId;
}
void NeoChatRoom::setHiddenFilter(std::function<bool(const Quotient::RoomEvent *)> hiddenFilter)
{
NeoChatRoom::m_hiddenFilter = hiddenFilter;
}
#include "moc_neochatroom.cpp"