From 4f4a775d9e44ae6caac8bdcad573d122aca00c7d Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 25 Oct 2021 05:19:35 -0400 Subject: [PATCH] Changeset: Improve handling of missing attribute in old pool --- src/static/js/Changeset.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index 2df33ec46..d261db748 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -1563,18 +1563,10 @@ exports.moveOpsToNewPool = (cs, oldPool, newPool) => { // order of attribs stays the same return upToDollar.replace(/\*([0-9a-z]+)/g, (_, a) => { const oldNum = exports.parseNum(a); - let pair = oldPool.getAttrib(oldNum); - - /* - * Setting an empty pair. Required for when delete pad contents / attributes - * while another user has the timeslider open. - * - * Fixes https://github.com/ether/etherpad-lite/issues/3932 - */ - if (!pair) { - pair = []; - } - + const pair = oldPool.getAttrib(oldNum); + // The attribute might not be in the old pool if the user is viewing the current revision in the + // timeslider and text is deleted. See: https://github.com/ether/etherpad-lite/issues/3932 + if (!pair) return ''; const newNum = newPool.putAttrib(pair); return `*${exports.numToString(newNum)}`; }) + fromDollar;