diff --git a/CHANGELOG.md b/CHANGELOG.md
index ecbb1eae..3c9d2101 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- Bugfix: Fixed flickering tooltips on Wayland when the mouse cursor is over them. (#6451)
- Bugfix: Fixed `c2.Channel` comparing `false` to the same channel. (#6456)
- Bugfix: Fixed an issue where the moderation icon was missing from the Moderation tab. (#6457)
+- Bugfix: Fixed "_A message from X has been deleted_" messages logging empty messages to disk. (#6465)
- Bugfix: Do not set default hotkeys for focusing splits on macOS, as Option + Arrows are used for cursor navigation. (#6470)
- Bugfix: Fixed CMD+Backspace not working in the input on macOS if there was a selection. (#6469)
- Dev: Added documentation for WebSockets to `wip-plugins.md`. (#6432)
diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp
index cf86d722..05123f2e 100644
--- a/src/messages/MessageBuilder.cpp
+++ b/src/messages/MessageBuilder.cpp
@@ -1255,22 +1255,25 @@ MessagePtr MessageBuilder::makeDeletionMessageFromIRC(
->setLink({Link::UserInfo, originalMessage->loginName});
builder.emplace("was deleted:", MessageElementFlag::Text,
MessageColor::System);
- if (originalMessage->messageText.length() > 50)
+
+ auto deletedMessageText = originalMessage->messageText;
+ if (deletedMessageText.length() > 50)
{
- builder
- .emplace(originalMessage->messageText.left(50) + "…",
- MessageElementFlag::Text, MessageColor::Text)
- ->setLink({Link::JumpToMessage, originalMessage->id});
- }
- else
- {
- builder
- .emplace(originalMessage->messageText,
- MessageElementFlag::Text, MessageColor::Text)
- ->setLink({Link::JumpToMessage, originalMessage->id});
+ deletedMessageText = deletedMessageText.left(50) + "…";
}
+
+ builder
+ .emplace(deletedMessageText, MessageElementFlag::Text,
+ MessageColor::Text)
+ ->setLink({Link::JumpToMessage, originalMessage->id});
builder.message().timeoutUser = "msg:" + originalMessage->id;
+ const auto deletionText =
+ QString("A message from %1 was deleted: %2")
+ .arg(originalMessage->loginName, deletedMessageText);
+ builder.message().messageText = deletionText;
+ builder.message().searchText = deletionText;
+
return builder.release();
}
diff --git a/tests/snapshots/IrcMessageHandler/clearmsg-non-truncated.json b/tests/snapshots/IrcMessageHandler/clearmsg-non-truncated.json
new file mode 100644
index 00000000..9ef8a0df
--- /dev/null
+++ b/tests/snapshots/IrcMessageHandler/clearmsg-non-truncated.json
@@ -0,0 +1,122 @@
+{
+ "input": "@tmi-sent-ts=1757929420105;room-id=111448817;target-msg-id=862716db-9a7c-4563-8480-af799769ae81;rm-received-ts=1757929420186;login=kooby_ :tmi.twitch.tv CLEARMSG #pajlada sup",
+ "output": [
+ {
+ "badgeInfos": {
+ },
+ "badges": [
+ ],
+ "channelName": "",
+ "count": 1,
+ "displayName": "",
+ "elements": [
+ {
+ "element": {
+ "color": "System",
+ "flags": "Timestamp",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "style": "TimestampMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "0:00"
+ ]
+ },
+ "flags": "Timestamp",
+ "format": "",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "time": "00:00:00",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TimestampElement"
+ },
+ {
+ "color": "System",
+ "flags": "Text",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "style": "ChatMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "A",
+ "message",
+ "from"
+ ]
+ },
+ {
+ "color": "System",
+ "flags": "Username",
+ "link": {
+ "type": "UserInfo",
+ "value": "kooby_"
+ },
+ "style": "ChatMediumBold",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "KOOBY_"
+ ]
+ },
+ {
+ "color": "System",
+ "flags": "Text",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "style": "ChatMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "was",
+ "deleted:"
+ ]
+ },
+ {
+ "color": "Text",
+ "flags": "Text",
+ "link": {
+ "type": "JumpToMessage",
+ "value": "862716db-9a7c-4563-8480-af799769ae81"
+ },
+ "style": "ChatMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "sup"
+ ]
+ }
+ ],
+ "flags": "System|DoNotTriggerNotification|ModerationAction",
+ "frozen": false,
+ "id": "",
+ "localizedName": "",
+ "loginName": "",
+ "messageText": "A message from kooby_ was deleted: sup",
+ "searchText": "A message from kooby_ was deleted: sup",
+ "serverReceivedTime": "",
+ "timeoutUser": "msg:862716db-9a7c-4563-8480-af799769ae81",
+ "userID": "",
+ "usernameColor": "#ff000000"
+ }
+ ],
+ "params": {
+ "prevMessages": [
+ "@display-name=KOOBY_;rm-received-ts=1757929402936;returning-chatter=0;historical=1;turbo=0;badges=no_audio/1;mod=0;subscriber=0;user-type=;flags=;room-id=11148817;badge-info=;color=#B9CCED;emotes=;id=862716db-9a7c-4563-8480-af799769ae81;first-msg=0;user-id=71642781;rm-deleted=1;tmi-sent-ts=1757929402746 :kooby_!kooby_@kooby_.tmi.twitch.tv PRIVMSG #pajlada sup"
+ ]
+ }
+}
diff --git a/tests/snapshots/IrcMessageHandler/clearmsg-truncated.json b/tests/snapshots/IrcMessageHandler/clearmsg-truncated.json
new file mode 100644
index 00000000..5dbb262b
--- /dev/null
+++ b/tests/snapshots/IrcMessageHandler/clearmsg-truncated.json
@@ -0,0 +1,131 @@
+{
+ "input": "@rm-received-ts=1757929422007;login=kooby_;room-id=111448817;tmi-sent-ts=1757929421924;target-msg-id=ee436bee-aaac-49db-9a87-755c29105f6a :tmi.twitch.tv CLEARMSG #pajlada :Hello! its me Winston! Go to your fridge and stuff your big belly with food. I need you big and fat. FAT. FATTER. FATTER... FATTER! I need you to gain weight and get bulbous.",
+ "output": [
+ {
+ "badgeInfos": {
+ },
+ "badges": [
+ ],
+ "channelName": "",
+ "count": 1,
+ "displayName": "",
+ "elements": [
+ {
+ "element": {
+ "color": "System",
+ "flags": "Timestamp",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "style": "TimestampMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "0:00"
+ ]
+ },
+ "flags": "Timestamp",
+ "format": "",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "time": "00:00:00",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TimestampElement"
+ },
+ {
+ "color": "System",
+ "flags": "Text",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "style": "ChatMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "A",
+ "message",
+ "from"
+ ]
+ },
+ {
+ "color": "System",
+ "flags": "Username",
+ "link": {
+ "type": "UserInfo",
+ "value": "kooby_"
+ },
+ "style": "ChatMediumBold",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "KOOBY_"
+ ]
+ },
+ {
+ "color": "System",
+ "flags": "Text",
+ "link": {
+ "type": "None",
+ "value": ""
+ },
+ "style": "ChatMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "was",
+ "deleted:"
+ ]
+ },
+ {
+ "color": "Text",
+ "flags": "Text",
+ "link": {
+ "type": "JumpToMessage",
+ "value": "ee436bee-aaac-49db-9a87-755c29105f6a"
+ },
+ "style": "ChatMedium",
+ "tooltip": "",
+ "trailingSpace": true,
+ "type": "TextElement",
+ "words": [
+ "Hello!",
+ "its",
+ "me",
+ "Winston!",
+ "Go",
+ "to",
+ "your",
+ "fridge",
+ "and",
+ "stuff…"
+ ]
+ }
+ ],
+ "flags": "System|DoNotTriggerNotification|ModerationAction",
+ "frozen": false,
+ "id": "",
+ "localizedName": "",
+ "loginName": "",
+ "messageText": "A message from kooby_ was deleted: Hello! its me Winston! Go to your fridge and stuff…",
+ "searchText": "A message from kooby_ was deleted: Hello! its me Winston! Go to your fridge and stuff…",
+ "serverReceivedTime": "",
+ "timeoutUser": "msg:ee436bee-aaac-49db-9a87-755c29105f6a",
+ "userID": "",
+ "usernameColor": "#ff000000"
+ }
+ ],
+ "params": {
+ "prevMessages": [
+ "@tmi-sent-ts=1757929410864;user-type=;room-id=11148817;mod=0;user-id=71642781;flags=;rm-received-ts=1757929411035;historical=1;subscriber=0;display-name=KOOBY_;id=ee436bee-aaac-49db-9a87-755c29105f6a;badge-info=;color=#B9CCED;emotes=;turbo=0;rm-deleted=1;first-msg=0;returning-chatter=0;badges=no_audio/1 :kooby_!kooby_@kooby_.tmi.twitch.tv PRIVMSG #pajlada :Hello! its me Winston! Go to your fridge and stuff your big belly with food. I need you big and fat. FAT. FATTER. FATTER... FATTER! I need you to gain weight and get bulbous."
+ ]
+ }
+}