From 3d11ddcc877dc9ec39e70bd92ceadcfc15592f56 Mon Sep 17 00:00:00 2001 From: Roland Pallai Date: Mon, 17 Apr 2023 08:39:59 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Alexey Rusakov --- client/chatroomwidget.cpp | 2 +- client/models/messageeventmodel.cpp | 14 +++++++------- client/models/messageeventmodel.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/chatroomwidget.cpp b/client/chatroomwidget.cpp index 8a8623e9..d4340b7e 100644 --- a/client/chatroomwidget.cpp +++ b/client/chatroomwidget.cpp @@ -794,7 +794,7 @@ bool ChatRoomWidget::setReferringMode(const int newMode, const QString& eventId, const char* icon_name) { Q_ASSERT( newMode == Replying || newMode == Editing ); - // Actually, we could let the user to refer to pending events too but in + // Actually, we could let the user refer to pending events too but in // this case we would need a universal pointer instead of event id. Now the // user cannot start to edit a pending message which might be annoying if // transactions are acknowledged slowly. diff --git a/client/models/messageeventmodel.cpp b/client/models/messageeventmodel.cpp index cd927822..fb76eb40 100644 --- a/client/models/messageeventmodel.cpp +++ b/client/models/messageeventmodel.cpp @@ -923,7 +923,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const evt, [](const RoomCreateEvent& e) { return e.predecessor().roomId; }, [](const RoomTombstoneEvent& e) { return e.successorRoomId(); }); - if (role == NudeRichBodyRole) + if (role == BareRichBodyRole) { auto e = eventCast(&evt); if (!e || !e->hasTextContent()) @@ -934,7 +934,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const QRegularExpression::DotMatchesEverythingOption }; static const QRegularExpression quoteLines("> .*(?:\n|$)"); - QString nudeBody; + QString bareBody; if (e->mimeType().name() != "text/plain") { // Naïvely assume that it's HTML auto htmlBody = @@ -942,13 +942,13 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const auto [cleanHtml, errorPos, errorString] = HtmlFilter::fromMatrixHtml(htmlBody.remove(quoteBlock), m_currentRoom); if (errorPos == -1) { - nudeBody = cleanHtml; + bareBody = cleanHtml; } } - if (nudeBody.isEmpty()) { - nudeBody = m_currentRoom->prettyPrint(e->plainBody().remove(quoteLines)); + if (bareBody.isEmpty()) { + bareBody = m_currentRoom->prettyPrint(e->plainBody().remove(quoteLines)); } - return nudeBody; + return bareBody; } if (role == QuotationRole) @@ -974,7 +974,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const { if (isPending) return QString(); // Cannot construct event link with unknown eventId - QString quotation = data(idx, NudeRichBodyRole).toString(); + QString quotation = data(idx, BareRichBodyRole).toString(); if (quotation.isEmpty()) return QString(); const auto authorUser = m_currentRoom->user(evt.senderId()); diff --git a/client/models/messageeventmodel.h b/client/models/messageeventmodel.h index e7dce6ea..48352206 100644 --- a/client/models/messageeventmodel.h +++ b/client/models/messageeventmodel.h @@ -45,7 +45,7 @@ class MessageEventModel: public QAbstractListModel RefRole, ReactionsRole, EventResolvedTypeRole, - NudeRichBodyRole, + BareRichBodyRole, QuotationRole, HtmlQuotationRole, };