Show thread on latest message
Use the new thread functionality in libQuotient to show the thread on the latest message rather than the root. Note: to test you need to bump your libquotient minor version to 10 or higher. Also Note: this reveals some other bugs in how new threads are shown or refreshed when new messages are added, this will be fixed in a later patch as some re-architecting is required
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
#include <Quotient/events/roommessageevent.h>
|
||||
#include <Quotient/events/stickerevent.h>
|
||||
#include <Quotient/qt_connection_util.h>
|
||||
#if Quotient_VERSION_MINOR > 9
|
||||
#include <Quotient/thread.h>
|
||||
#endif
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <Kirigami/Platform/PlatformTheme>
|
||||
@@ -484,7 +487,11 @@ QList<MessageComponent> MessageContentModel::messageContentComponents(bool isEdi
|
||||
}
|
||||
|
||||
// If the event is already threaded the ThreadModel will handle displaying a chat bar.
|
||||
#if Quotient_VERSION_MINOR > 9
|
||||
if (isThreading && roomMessageEvent && !(roomMessageEvent->isThreaded() || m_room->threads().contains(roomMessageEvent->id()))) {
|
||||
#else
|
||||
if (isThreading && roomMessageEvent && roomMessageEvent->isThreaded()) {
|
||||
#endif
|
||||
newComponents += MessageComponent{MessageComponentType::ChatBar, QString(), {}};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <Quotient/events/roommessageevent.h>
|
||||
#include <Quotient/events/stickerevent.h>
|
||||
#include <Quotient/roommember.h>
|
||||
#if Quotient_VERSION_MINOR > 9
|
||||
#include <Quotient/thread.h>
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
@@ -477,9 +480,18 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
}
|
||||
|
||||
auto roomMessageEvent = eventCast<const RoomMessageEvent>(&evt);
|
||||
#if Quotient_VERSION_MINOR > 9
|
||||
if (roomMessageEvent && (roomMessageEvent->isThreaded() || m_currentRoom->threads().contains(evt.id()))) {
|
||||
const auto &thread = m_currentRoom->threads().value(roomMessageEvent->isThreaded() ? roomMessageEvent->threadRootEventId() : evt.id());
|
||||
if (thread.latestEventId != evt.id()) {
|
||||
return EventStatus::Hidden;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (roomMessageEvent && roomMessageEvent->isThreaded() && roomMessageEvent->threadRootEventId() != evt.id() && NeoChatConfig::threads()) {
|
||||
return EventStatus::Hidden;
|
||||
}
|
||||
#endif
|
||||
|
||||
return EventStatus::Normal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user