Fix showAuthor

This commit is contained in:
James Graham
2024-07-21 16:39:53 +01:00
parent a2a8ad09fd
commit 0867eef5ce
3 changed files with 4 additions and 8 deletions

View File

@@ -4,11 +4,13 @@
#include "messagefiltermodel.h"
#include <KLocalizedString>
#include <qvariant.h>
#include "enums/delegatetype.h"
#include "messagecontentmodel.h"
#include "messageeventmodel.h"
#include "neochatconfig.h"
#include "neochatroommember.h"
#include "timelinemodel.h"
using namespace Quotient;
@@ -120,7 +122,8 @@ bool MessageFilterModel::showAuthor(QModelIndex index) const
// While the row is removed the subsequent row indexes are not changed so we need to skip over the removed index.
// See - https://doc.qt.io/qt-5/qabstractitemmodel.html#beginRemoveRows
if (data(i, MessageEventModel::SpecialMarksRole) != EventStatus::Hidden && !itemData(i).empty()) {
return data(i, MessageEventModel::AuthorRole) != data(index, MessageEventModel::AuthorRole)
return qvariant_cast<NeochatRoomMember *>(data(i, MessageEventModel::AuthorRole))->id()
!= qvariant_cast<NeochatRoomMember *>(data(index, MessageEventModel::AuthorRole))->id()
|| data(i, MessageEventModel::DelegateTypeRole) == DelegateType::State
|| data(i, MessageEventModel::TimeRole).toDateTime().msecsTo(data(index, MessageEventModel::TimeRole).toDateTime()) > 600000
|| data(i, MessageEventModel::TimeRole).toDateTime().toLocalTime().date().day()

View File

@@ -23,11 +23,6 @@ NeochatRoomMember::NeochatRoomMember(NeoChatRoom *room, const QString &memberId)
}
}
bool NeochatRoomMember::operator==(const NeochatRoomMember &other) const
{
return id() == other.id();
}
QString NeochatRoomMember::id() const
{
return m_memberId;

View File

@@ -51,8 +51,6 @@ public:
explicit NeochatRoomMember(NeoChatRoom *room, const QString &memberId);
bool operator==(const NeochatRoomMember &other) const;
/**
* @brief Get unique stable user id
*