Skip to content

Commit a13d8a2

Browse files
committed
Changeset: Improve handling of missing attribute in old pool
1 parent 7c1e2fc commit a13d8a2

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
@@ -1563,18 +1563,10 @@ exports.moveOpsToNewPool = (cs, oldPool, newPool) => {
15631563
// order of attribs stays the same
15641564
return upToDollar.replace(/\*([0-9a-z]+)/g, (_, a) => {
15651565
const oldNum = exports.parseNum(a);
1566-
let pair = oldPool.getAttrib(oldNum);
1567-
1568-
/*
1569-
* Setting an empty pair. Required for when delete pad contents / attributes
1570-
* while another user has the timeslider open.
1571-
*
1572-
* Fixes https://github.com/ether/etherpad-lite/issues/3932
1573-
*/
1574-
if (!pair) {
1575-
pair = [];
1576-
}
1577-
1566+
const pair = oldPool.getAttrib(oldNum);
1567+
// The attribute might not be in the old pool if the user is viewing the current revision in the
1568+
// timeslider and text is deleted. See: https://github.com/ether/etherpad-lite/issues/3932
1569+
if (!pair) return '';
15781570
const newNum = newPool.putAttrib(pair);
15791571
return `*${exports.numToString(newNum)}`;
15801572
}) + fromDollar;

0 commit comments

Comments
 (0)