Unify redaction handling
The code in messageeventmodel was calling to EventHandler::getBody who
already handles reaction handlings
(cherry picked from commit 16b27700f5)
This commit is contained in:
committed by
Tobias Fella
parent
0f05c1b921
commit
18db04d073
@@ -294,7 +294,7 @@ QString EventHandler::getBody(const Quotient::RoomEvent *event, Qt::TextFormat f
|
|||||||
{
|
{
|
||||||
if (event->isRedacted()) {
|
if (event->isRedacted()) {
|
||||||
auto reason = event->redactedBecause()->reason();
|
auto reason = event->redactedBecause()->reason();
|
||||||
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>") : i18n("<i>[This message was deleted: %1]</i>", reason);
|
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>") : i18n("<i>[This message was deleted: %1]</i>", reason.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool prettyPrint = (format == Qt::RichText);
|
const bool prettyPrint = (format == Qt::RichText);
|
||||||
|
|||||||
@@ -225,11 +225,6 @@ QVariant MessageContentModel::data(const QModelIndex &index, int role) const
|
|||||||
if (m_event == nullptr) {
|
if (m_event == nullptr) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
if (m_event->isRedacted()) {
|
|
||||||
auto reason = m_event->redactedBecause()->reason();
|
|
||||||
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>")
|
|
||||||
: i18n("<i>[This message was deleted: %1]</i>", m_event->redactedBecause()->reason());
|
|
||||||
}
|
|
||||||
if (!component.content.isEmpty()) {
|
if (!component.content.isEmpty()) {
|
||||||
return component.content;
|
return component.content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,11 +433,6 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
|||||||
EventHandler eventHandler(m_currentRoom, &evt);
|
EventHandler eventHandler(m_currentRoom, &evt);
|
||||||
|
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
if (evt.isRedacted()) {
|
|
||||||
auto reason = evt.redactedBecause()->reason();
|
|
||||||
return (reason.isEmpty()) ? i18n("<i>[This message was deleted]</i>")
|
|
||||||
: i18n("<i>[This message was deleted: %1]</i>", evt.redactedBecause()->reason().toHtmlEscaped());
|
|
||||||
}
|
|
||||||
return eventHandler.getRichBody();
|
return eventHandler.getRichBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user