From cd9c4239b116f30de3bf0d1ca600dad3ddb1b442 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Sun, 28 Apr 2024 08:00:48 -0600 Subject: [PATCH] Revert "Preserve mx-reply in the edited message if it exists" This reverts commit fa57db8e831fa1a1c26a451647affdbeea1a7fd3, because it caused the last message you replied to to be shown as a reply in every subsequent message you send, but they're only visible to people using clients that aren't NeoChat, so you don't immediately realize that you're causing pandemonium in your chatrooms. --- src/actionshandler.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/actionshandler.cpp b/src/actionshandler.cpp index 94fc4b58d..8fd3cf535 100644 --- a/src/actionshandler.cpp +++ b/src/actionshandler.cpp @@ -14,7 +14,6 @@ #include "models/actionsmodel.h" #include "neochatconfig.h" #include "texthandler.h" -#include "utils.h" using namespace Quotient; @@ -146,26 +145,6 @@ void ActionsHandler::handleMessage(const QString &text, QString handledText, Cha return; } - // We want to add back the if it's in the original message but not in the edit, to preserve the reply. - for (auto it = m_room->messageEvents().crbegin(); it != m_room->messageEvents().crend(); it++) { - if (const auto event = eventCast(&**it)) { - if (event->senderId() == m_room->localUser()->id() && event->hasTextContent()) { - QString originalString; - if (event->content()) { - originalString = static_cast(event->content())->body; - } else { - originalString = event->plainBody(); - } - - const QRegularExpression exp(TextRegex::removeRichReply); - const auto match = exp.match(originalString); - if (match.hasCaptured(0) && !handledText.contains(TextRegex::removeRichReply)) { - handledText.prepend(match.captured(0)); - } - } - } - } - m_room->postMessage(text, handledText, messageType, chatBarCache->replyId(), chatBarCache->editId(), chatBarCache->threadId()); }