Skip to content

Commit 52f85e4

Browse files
committed
Changeset: Improve handling of missing attribute in old pool
1 parent 22127b8 commit 52f85e4

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/static/js/Changeset.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,18 +1561,10 @@ exports.moveOpsToNewPool = (cs, oldPool, newPool) => {
15611561
// order of attribs stays the same
15621562
return upToDollar.replace(/\*([0-9a-z]+)/g, (_, a) => {
15631563
const oldNum = exports.parseNum(a);
1564-
let pair = oldPool.getAttrib(oldNum);
1565-
1566-
/*
1567-
* Setting an empty pair. Required for when delete pad contents / attributes
1568-
* while another user has the timeslider open.
1569-
*
1570-
* Fixes https://github.com/ether/etherpad-lite/issues/3932
1571-
*/
1572-
if (!pair) {
1573-
pair = [];
1574-
}
1575-
1564+
const pair = oldPool.getAttrib(oldNum);
1565+
// The attribute might not be in the old pool if the user is viewing the current revision in the
1566+
// timeslider and text is deleted. See: https://github.com/ether/etherpad-lite/issues/3932
1567+
if (!pair) return '';
15761568
const newNum = newPool.putAttrib(pair);
15771569
return `*${exports.numToString(newNum)}`;
15781570
}) + fromDollar;

0 commit comments

Comments
 (0)