From 4f350ae223d08de4bb1c083749f64616b97a963a Mon Sep 17 00:00:00 2001 From: Giorgi Taba Kobakhidze Date: Fri, 17 Feb 2023 23:35:44 +0100 Subject: [PATCH] components/app: ensure msg.tags is initialized Fixes the following error when sending a message on a server without echo-message: Uncaught TypeError: t.tags is undefined prepareChatMessage app.js:602 handleChatMessage app.js:616 privmsg app.js:1514 handleComposerSubmit app.js:1535 handleSubmit composer.js:30 Preact 15 handleMessage app.js:1013 connect app.js:791 handleMessage client.js:448 reconnect client.js:176 reconnect client.js:174 Yt client.js:151 connect app.js:754 handleConnectSubmit app.js:1279 handleSubmit connect-form.js:74 Preact 16 handleConfig app.js:382 app.js:238 promise callback* app.js:237 Preact 4 main.js:4 --- components/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/app.js b/components/app.js index 48dc72b..f92ea67 100644 --- a/components/app.js +++ b/components/app.js @@ -599,6 +599,10 @@ export default class App extends Component { msg.isHighlight = irc.isHighlight(msg, client.nick, client.cm) || irc.isServerBroadcast(msg); } + if (!msg.tags) { + // Can happen for outgoing messages for instance + msg.tags = {}; + } if (!msg.tags.time) { msg.tags.time = irc.formatDate(new Date()); }