Fix #108.
This commit is contained in:
@@ -267,7 +267,8 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
|
|||||||
const auto& evt = isPending ? **pendingIt : **timelineIt;
|
const auto& evt = isPending ? **pendingIt : **timelineIt;
|
||||||
|
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
return utils::removeReply(m_currentRoom->eventToString(evt, Qt::RichText));
|
return utils::cleanHTML(
|
||||||
|
utils::removeReply(m_currentRoom->eventToString(evt, Qt::RichText)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == MessageRole) {
|
if (role == MessageRole) {
|
||||||
@@ -410,8 +411,8 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
|
|||||||
case ReplyEventIdRole:
|
case ReplyEventIdRole:
|
||||||
return replyEventId;
|
return replyEventId;
|
||||||
case ReplyDisplayRole:
|
case ReplyDisplayRole:
|
||||||
return utils::removeReply(
|
return utils::cleanHTML(utils::removeReply(
|
||||||
m_currentRoom->eventToString(replyEvt, Qt::RichText));
|
m_currentRoom->eventToString(replyEvt, Qt::RichText)));
|
||||||
case ReplyAuthorRole:
|
case ReplyAuthorRole:
|
||||||
return QVariant::fromValue(m_currentRoom->user(replyEvt.senderId()));
|
return QVariant::fromValue(m_currentRoom->user(replyEvt.senderId()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ QString utils::removeReply(const QString& text) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString utils::cleanHTML(const QString& text, QMatrixClient::Room* room) {
|
QString utils::cleanHTML(const QString& text) {
|
||||||
QString result(text);
|
QString result(text);
|
||||||
result.replace(codePillRegExp, "<i>\\1</i>");
|
result.replace(codePillRegExp, "<i>\\1</i>");
|
||||||
result.replace(userPillRegExp, "<b>\\1</b>");
|
result.replace(userPillRegExp, "<b>\\1</b>");
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static const QRegularExpression userPillRegExp{
|
|||||||
QRegularExpression::DotMatchesEverythingOption};
|
QRegularExpression::DotMatchesEverythingOption};
|
||||||
|
|
||||||
QString removeReply(const QString& text);
|
QString removeReply(const QString& text);
|
||||||
QString cleanHTML(const QString& text, QMatrixClient::Room* room);
|
QString cleanHTML(const QString& text);
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user