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:
@@ -99,6 +99,7 @@ Controller::Controller(QObject *parent)
|
|||||||
MessageModel::setHiddenFilter(hiddenEventFilter);
|
MessageModel::setHiddenFilter(hiddenEventFilter);
|
||||||
RoomListModel::setHiddenFilter(hiddenEventFilter);
|
RoomListModel::setHiddenFilter(hiddenEventFilter);
|
||||||
RoomTreeModel::setHiddenFilter(hiddenEventFilter);
|
RoomTreeModel::setHiddenFilter(hiddenEventFilter);
|
||||||
|
NeoChatRoom::setHiddenFilter(hiddenEventFilter);
|
||||||
|
|
||||||
MediaSizeHelper::setMaxSize(NeoChatConfig::mediaMaxWidth(), NeoChatConfig::mediaMaxHeight());
|
MediaSizeHelper::setMaxSize(NeoChatConfig::mediaMaxWidth(), NeoChatConfig::mediaMaxHeight());
|
||||||
connect(NeoChatConfig::self(), &NeoChatConfig::MediaMaxWidthChanged, this, []() {
|
connect(NeoChatConfig::self(), &NeoChatConfig::MediaMaxWidthChanged, this, []() {
|
||||||
|
|||||||
@@ -59,6 +59,10 @@
|
|||||||
|
|
||||||
using namespace Quotient;
|
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)
|
NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinState)
|
||||||
: Room(connection, std::move(roomId), joinState)
|
: Room(connection, std::move(roomId), joinState)
|
||||||
{
|
{
|
||||||
@@ -369,7 +373,7 @@ const RoomEvent *NeoChatRoom::lastEvent(std::function<bool(const RoomEvent *)> f
|
|||||||
|
|
||||||
void NeoChatRoom::cacheLastEvent()
|
void NeoChatRoom::cacheLastEvent()
|
||||||
{
|
{
|
||||||
auto event = lastEvent();
|
auto event = lastEvent(m_hiddenFilter);
|
||||||
if (event != nullptr) {
|
if (event != nullptr) {
|
||||||
auto &roomLastMessageProvider = RoomLastMessageProvider::self();
|
auto &roomLastMessageProvider = RoomLastMessageProvider::self();
|
||||||
|
|
||||||
@@ -1718,4 +1722,9 @@ QString NeoChatRoom::rootIdForThread(const QString &eventId) const
|
|||||||
return rootId;
|
return rootId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NeoChatRoom::setHiddenFilter(std::function<bool(const Quotient::RoomEvent *)> hiddenFilter)
|
||||||
|
{
|
||||||
|
NeoChatRoom::m_hiddenFilter = hiddenFilter;
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_neochatroom.cpp"
|
#include "moc_neochatroom.cpp"
|
||||||
|
|||||||
@@ -587,6 +587,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE QString rootIdForThread(const QString &eventId) const;
|
Q_INVOKABLE QString rootIdForThread(const QString &eventId) const;
|
||||||
|
|
||||||
|
static void setHiddenFilter(std::function<bool(const Quotient::RoomEvent *)> hiddenFilter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_visible = false;
|
bool m_visible = false;
|
||||||
|
|
||||||
@@ -618,6 +620,7 @@ private:
|
|||||||
void cleanupExtraEvent(const QString &eventId);
|
void cleanupExtraEvent(const QString &eventId);
|
||||||
|
|
||||||
std::unordered_map<QString, std::unique_ptr<NeochatRoomMember>> m_memberObjects;
|
std::unordered_map<QString, std::unique_ptr<NeochatRoomMember>> m_memberObjects;
|
||||||
|
static std::function<bool(const Quotient::RoomEvent *)> m_hiddenFilter;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updatePushNotificationState(QString type);
|
void updatePushNotificationState(QString type);
|
||||||
|
|||||||
Reference in New Issue
Block a user