Changeset: Improve handling of missing attribute in old pool
parent
b62534a6b2
commit
4f4a775d9e
|
@ -1563,18 +1563,10 @@ exports.moveOpsToNewPool = (cs, oldPool, newPool) => {
|
||||||
// order of attribs stays the same
|
// order of attribs stays the same
|
||||||
return upToDollar.replace(/\*([0-9a-z]+)/g, (_, a) => {
|
return upToDollar.replace(/\*([0-9a-z]+)/g, (_, a) => {
|
||||||
const oldNum = exports.parseNum(a);
|
const oldNum = exports.parseNum(a);
|
||||||
let pair = oldPool.getAttrib(oldNum);
|
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
|
||||||
* Setting an empty pair. Required for when delete pad contents / attributes
|
if (!pair) return '';
|
||||||
* while another user has the timeslider open.
|
|
||||||
*
|
|
||||||
* Fixes https://github.com/ether/etherpad-lite/issues/3932
|
|
||||||
*/
|
|
||||||
if (!pair) {
|
|
||||||
pair = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const newNum = newPool.putAttrib(pair);
|
const newNum = newPool.putAttrib(pair);
|
||||||
return `*${exports.numToString(newNum)}`;
|
return `*${exports.numToString(newNum)}`;
|
||||||
}) + fromDollar;
|
}) + fromDollar;
|
||||||
|
|
Loading…
Reference in New Issue