From e8e475956b3d2a57981ad41536a1ddc1b7361591 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 17 Dec 2022 01:11:19 +0100 Subject: Fix confetti in the sidebar --- src/Utils.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/Utils.h') diff --git a/src/Utils.h b/src/Utils.h index e4c3ccb3..31a1a0de 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -89,9 +89,6 @@ firstChar(const QString &input); QString humanReadableFileSize(uint64_t bytes); -QString -event_body(const mtx::events::collections::TimelineEvents &event); - //! Match widgets/events with a description message. template QString @@ -107,6 +104,7 @@ messageDescription(const QString &username = QString(), using Sticker = mtx::events::Sticker; 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; @@ -158,6 +156,23 @@ messageDescription(const QString &username = QString(), else return QCoreApplication::translate("message-description sent:", "%1: %2") .arg(username, body); + } else if (std::is_same::value) { + if (body.isEmpty()) { + if (isLocal) + return QCoreApplication::translate("message-description sent:", + "You sent some confetti"); + else + return QCoreApplication::translate("message-description sent:", + "%1 sent some confetti") + .arg(username); + } else { + if (isLocal) + return QCoreApplication::translate("message-description sent:", "You: %1") + .arg(body); + else + return QCoreApplication::translate("message-description sent:", "%1: %2") + .arg(username, body); + } } else if (std::is_same::value) { return QStringLiteral("* %1 %2").arg(username, body); } else if (std::is_same::value) { -- cgit 1.5.1