Release threads removing the feature flag.

This mr performs some final cleanup to make sure the threads are sized correctly and it all works with the new chatbar
This commit is contained in:
James Graham
2026-02-15 15:26:49 +00:00
committed by Joshua Goins
parent 85b731e9fb
commit 7e6b79d5d4
18 changed files with 60 additions and 93 deletions

View File

@@ -22,8 +22,6 @@
using namespace Quotient;
bool EventMessageContentModel::m_threadsEnabled = false;
EventMessageContentModel::EventMessageContentModel(NeoChatRoom *room, const QString &eventId, bool isReply, bool isPending, MessageContentModel *parent)
: MessageContentModel(room, eventId, parent)
, m_currentState(isPending ? Pending : Unknown)
@@ -104,9 +102,6 @@ void EventMessageContentModel::initializeModel()
}
}
});
connect(this, &EventMessageContentModel::threadsEnabledChanged, this, [this]() {
resetModel();
});
connect(m_room, &Room::updatedEvent, this, [this](const QString &eventId) {
if (eventId == m_eventId) {
updateReactionModel();
@@ -304,7 +299,7 @@ QList<MessageComponent> EventMessageContentModel::messageContentComponents(bool
}
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
if (m_threadsEnabled && roomMessageEvent
if (roomMessageEvent
&& ((roomMessageEvent->isThreaded() && roomMessageEvent->id() == roomMessageEvent->threadRootEventId())
|| m_room->threads().contains(roomMessageEvent->id()))) {
newComponents += MessageComponent{MessageComponentType::Separator, {}, {}};
@@ -328,14 +323,14 @@ std::optional<QString> EventMessageContentModel::getReplyEventId()
if (roomMessageEvent == nullptr) {
return std::nullopt;
}
if (!roomMessageEvent->isReply(!m_threadsEnabled)) {
if (!roomMessageEvent->isReply()) {
if (m_replyModel) {
m_replyModel->disconnect(this);
m_replyModel->deleteLater();
}
return std::nullopt;
}
return roomMessageEvent->isReply(!m_threadsEnabled) ? std::make_optional(roomMessageEvent->replyEventId(!m_threadsEnabled)) : std::nullopt;
return roomMessageEvent->isReply() ? std::make_optional(roomMessageEvent->replyEventId()) : std::nullopt;
}
QList<MessageComponent> EventMessageContentModel::componentsForType(MessageComponentType::Type type)
@@ -475,9 +470,4 @@ ThreadModel *EventMessageContentModel::modelForThread(const QString &threadRootI
return ContentProvider::self().modelForThread(m_room, threadRootId);
}
void EventMessageContentModel::setThreadsEnabled(bool enableThreads)
{
m_threadsEnabled = enableThreads;
}
#include "moc_eventmessagecontentmodel.cpp"

View File

@@ -43,11 +43,8 @@ public:
*/
Q_INVOKABLE ThreadModel *modelForThread(const QString &threadRootId);
static void setThreadsEnabled(bool enableThreads);
Q_SIGNALS:
void eventUpdated();
void threadsEnabledChanged();
private:
void initializeModel();
@@ -74,6 +71,4 @@ private:
void updateItineraryModel();
void updateReactionModel();
static bool m_threadsEnabled;
};