From 452db293b0b202175888e5842182f90dc8bfd6de Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 24 Apr 2020 18:11:36 +0000 Subject: [PATCH] changeset.js: do not lose sync in the timeslider if another user deletes text If a user deleted text/attributes while another one had the timeslider open, the timeslider lost sync and spit out errors. Fixes #3932. --- src/static/js/Changeset.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index e8d182653..e4e6d2d63 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -1529,7 +1529,17 @@ exports.moveOpsToNewPool = function (cs, oldPool, newPool) { return upToDollar.replace(/\*([0-9a-z]+)/g, function (_, a) { var oldNum = exports.parseNum(a); var pair = oldPool.getAttrib(oldNum); - if(!pair) exports.error('Can\'t copy unknown attrib (reference attrib string to non-existant pool entry). Inconsistent attrib state!'); + + /* + * 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 = []; + } + var newNum = newPool.putAttrib(pair); return '*' + exports.numToString(newNum); }) + fromDollar;