Only hide replaced rooms if we're joined to the replacement room
This commit is contained in:
@@ -368,6 +368,9 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
|||||||
if (role == IsChildSpaceRole) {
|
if (role == IsChildSpaceRole) {
|
||||||
return SpaceHierarchyCache::instance().isChildSpace(room->id());
|
return SpaceHierarchyCache::instance().isChildSpace(room->id());
|
||||||
}
|
}
|
||||||
|
if (role == ReplacementIdRole) {
|
||||||
|
return room->successorId();
|
||||||
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public:
|
|||||||
RoomIdRole, /**< The room matrix ID. */
|
RoomIdRole, /**< The room matrix ID. */
|
||||||
IsSpaceRole, /**< Whether the room is a space. */
|
IsSpaceRole, /**< Whether the room is a space. */
|
||||||
IsChildSpaceRole, /**< Whether this space is a child of a different space. */
|
IsChildSpaceRole, /**< Whether this space is a child of a different space. */
|
||||||
|
ReplacementIdRole, /**< The room id of the room replacing this one, if any. */
|
||||||
};
|
};
|
||||||
Q_ENUM(EventRoles)
|
Q_ENUM(EventRoles)
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "sortfilterroomlistmodel.h"
|
#include "sortfilterroomlistmodel.h"
|
||||||
|
|
||||||
|
#include "neochatconnection.h"
|
||||||
#include "roomlistmodel.h"
|
#include "roomlistmodel.h"
|
||||||
#include "spacehierarchycache.h"
|
#include "spacehierarchycache.h"
|
||||||
|
|
||||||
@@ -78,9 +79,15 @@ bool SortFilterRoomListModel::filterAcceptsRow(int source_row, const QModelIndex
|
|||||||
{
|
{
|
||||||
Q_UNUSED(source_parent);
|
Q_UNUSED(source_parent);
|
||||||
|
|
||||||
|
if (sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::JoinStateRole).toString() == QStringLiteral("upgraded")
|
||||||
|
&& dynamic_cast<RoomListModel *>(sourceModel())
|
||||||
|
->connection()
|
||||||
|
->room(sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::ReplacementIdRole).toString())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool acceptRoom =
|
bool acceptRoom =
|
||||||
sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::DisplayNameRole).toString().contains(m_filterText, Qt::CaseInsensitive)
|
sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::DisplayNameRole).toString().contains(m_filterText, Qt::CaseInsensitive)
|
||||||
&& sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::JoinStateRole).toString() != QStringLiteral("upgraded")
|
|
||||||
&& sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::IsSpaceRole).toBool() == false;
|
&& sourceModel()->data(sourceModel()->index(source_row, 0), RoomListModel::IsSpaceRole).toBool() == false;
|
||||||
|
|
||||||
if (m_activeSpaceId.isEmpty()) {
|
if (m_activeSpaceId.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user