From e8e475956b3d2a57981ad41536a1ddc1b7361591 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 17 Dec 2022 01:11:19 +0100 Subject: [PATCH] Fix confetti in the sidebar --- src/Utils.cpp | 42 ++++++++++++------------------------------ src/Utils.h | 21 ++++++++++++++++++--- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index c19871bc..b0d84339 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -45,16 +45,17 @@ createDescriptionInfo(const Event &event, const QString &localUser, const QStrin const auto username = displayName; const auto ts = QDateTime::fromMSecsSinceEpoch(msg.origin_server_ts); - auto body = utils::event_body(event).trimmed(); + auto body = mtx::accessors::body(event); if (mtx::accessors::relations(event).reply_to()) - body = QString::fromStdString(utils::stripReplyFromBody(body.toStdString())); + body = utils::stripReplyFromBody(body); - return DescInfo{QString::fromStdString(msg.event_id), - sender, - utils::messageDescription(username, body, sender == localUser), - utils::descriptiveTime(ts), - msg.origin_server_ts, - ts}; + return DescInfo{ + QString::fromStdString(msg.event_id), + sender, + utils::messageDescription(username, QString::fromStdString(body), sender == localUser), + utils::descriptiveTime(ts), + msg.origin_server_ts, + ts}; } std::string @@ -216,6 +217,7 @@ utils::getMessageDescription(const TimelineEvent &event, using Notice = mtx::events::RoomEvent; using Text = mtx::events::RoomEvent; using Video = mtx::events::RoomEvent; + using Confetti = mtx::events::RoomEvent; using CallInvite = mtx::events::RoomEvent; using CallAnswer = mtx::events::RoomEvent; using CallHangUp = mtx::events::RoomEvent; @@ -236,6 +238,8 @@ utils::getMessageDescription(const TimelineEvent &event, return createDescriptionInfo(event, localUser, displayName); } else if (std::holds_alternative