From 648ebd432132867079c6cb44f5077806ead5bd2c Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 25 Sep 2024 09:23:03 +0100 Subject: [PATCH] Tweak slightly confusing coee that tries to set Object property name to an array --- apps/reply/lib.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/reply/lib.js b/apps/reply/lib.js index 50d22e6ba..617da85e7 100644 --- a/apps/reply/lib.js +++ b/apps/reply/lib.js @@ -49,13 +49,12 @@ exports.reply = function (options) { replies.forEach((reply) => { var displayString = reply.disp ?? reply.text; - var truncatedDisplayString = g.wrapString(displayString, 120); + var wrappedDisplayString = g.wrapString(displayString, 120); // Generally handles truncating nicely, but falls down in long runs of emoji since they count as one image - if (truncatedDisplayString.length > 1) { - truncatedDisplayString = truncatedDisplayString.slice(0,1); - truncatedDisplayString[truncatedDisplayString.length-1] += "..."; + if (wrappedDisplayString.length > 1) { + displayString = wrappedDisplayString[0]+"..."; } - menu = Object.defineProperty(menu, truncatedDisplayString, { + menu = Object.defineProperty(menu, displayString, { value: () => constructReply(options.msg ?? {}, reply.text, resolve, reject), }); }); @@ -84,4 +83,4 @@ exports.reply = function (options) { E.showMenu(menu); } }); -}; \ No newline at end of file +};