Strip replies when calling EventHandler::getMarkdownBody()
This matches previous behavior before
e2eb6ab33c and including the markdown
blockquote breaks edits. This also adds a test to ensure it does indeed
get stripped.
This commit is contained in:
committed by
James Graham
parent
46a9600d55
commit
9d3c2e19f5
@@ -56,6 +56,7 @@ private Q_SLOTS:
|
|||||||
void genericBody();
|
void genericBody();
|
||||||
void nullGenericBody();
|
void nullGenericBody();
|
||||||
void markdownBody();
|
void markdownBody();
|
||||||
|
void markdownBodyReply();
|
||||||
void subtitle();
|
void subtitle();
|
||||||
void nullSubtitle();
|
void nullSubtitle();
|
||||||
void mediaInfo();
|
void mediaInfo();
|
||||||
@@ -301,6 +302,13 @@ void EventHandlerTest::markdownBody()
|
|||||||
QCOMPARE(eventHandler.getMarkdownBody(), QStringLiteral("This is an example\ntext message"));
|
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()
|
void EventHandlerTest::subtitle()
|
||||||
{
|
{
|
||||||
EventHandler eventHandler(room, room->messageEvents().at(0).get());
|
EventHandler eventHandler(room, room->messageEvents().at(0).get());
|
||||||
|
|||||||
@@ -293,7 +293,10 @@ QString EventHandler::getMarkdownBody() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto roomMessageEvent = eventCast<const RoomMessageEvent>(m_event);
|
const auto roomMessageEvent = eventCast<const RoomMessageEvent>(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
|
QString EventHandler::getBody(const Quotient::RoomEvent *event, Qt::TextFormat format, bool stripNewlines) const
|
||||||
|
|||||||
Reference in New Issue
Block a user