diff --git a/autotests/eventhandlertest.cpp b/autotests/eventhandlertest.cpp index 7df92639a..cb3dde831 100644 --- a/autotests/eventhandlertest.cpp +++ b/autotests/eventhandlertest.cpp @@ -56,6 +56,7 @@ private Q_SLOTS: void genericBody(); void nullGenericBody(); void markdownBody(); + void markdownBodyReply(); void subtitle(); void nullSubtitle(); void mediaInfo(); @@ -301,6 +302,13 @@ void EventHandlerTest::markdownBody() QCOMPARE(eventHandler.getMarkdownBody(), QStringLiteral("This is an example\ntext message")); } +void EventHandlerTest::markdownBodyReply() +{ + EventHandler eventHandler(room, room->messageEvents().at(5).get()); + + QCOMPARE(eventHandler.getMarkdownBody(), QStringLiteral("reply")); +} + void EventHandlerTest::subtitle() { EventHandler eventHandler(room, room->messageEvents().at(0).get()); diff --git a/src/eventhandler.cpp b/src/eventhandler.cpp index 4b26411d7..c737d68f4 100644 --- a/src/eventhandler.cpp +++ b/src/eventhandler.cpp @@ -293,7 +293,10 @@ QString EventHandler::getMarkdownBody() const } const auto roomMessageEvent = eventCast(m_event); - return roomMessageEvent->plainBody(); + + QString plainBody = roomMessageEvent->plainBody(); + plainBody.remove(TextRegex::removeReply); + return plainBody; } QString EventHandler::getBody(const Quotient::RoomEvent *event, Qt::TextFormat format, bool stripNewlines) const