From 7821de4a8d7789194c3e39f040d7a56dc94a8728 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 2 Sep 2024 13:49:56 +0200 Subject: [PATCH] Don't end kick messages without a reason with a ":" BUG: 492512 --- src/eventhandler.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/eventhandler.cpp b/src/eventhandler.cpp index d62645cf8..70e610cec 100644 --- a/src/eventhandler.cpp +++ b/src/eventhandler.cpp @@ -366,9 +366,13 @@ QString EventHandler::getBody(const NeoChatRoom *room, const Quotient::RoomEvent if (e.prevContent() && e.prevContent()->membership == Membership::Ban) { return (e.senderId() != e.userId()) ? i18n("unbanned %1", subjectName) : i18n("self-unbanned"); } - return (e.senderId() != e.userId()) - ? i18n("has put %1 out of the room: %2", subjectName, e.contentJson()["reason"_ls].toString().toHtmlEscaped()) - : i18n("left the room"); + if (e.senderId() == e.userId()) { + return i18n("left the room"); + } + if (const auto &reason = e.contentJson()["reason"_ls].toString().toHtmlEscaped(); !reason.isEmpty()) { + return i18n("has put %1 out of the room: %2", subjectName, reason); + } + return i18n("has put %1 out of the room", subjectName); case Membership::Ban: if (e.senderId() != e.userId()) { if (e.reason().isEmpty()) {