mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 01:46:14 -04:00
undomodule: disallow undoing "clear authorship colors"
Clearing the authorship colors of a document with at least two authors, and then undoing that action caused a disconnect from the pad. This change disallows undoing clearing authorship colors in order to prevent the problem from affecting users, and adds the relative test coverage. This is a change of behaviour, and is documented in the changelog. Fixes #2802 (sidestepping it).
This commit is contained in:
parent
ffc718e8c0
commit
babf67175c
8 changed files with 90 additions and 4 deletions
|
@ -791,6 +791,9 @@ exports.textLinesMutator = function (lines) {
|
|||
}
|
||||
} else {
|
||||
var sline = putCurLineInSplice();
|
||||
if (!curSplice[sline]) {
|
||||
console.error("curSplice[sline] not populated, actual curSplice contents is ", curSplice, ". Possibly related to https://github.com/ether/etherpad-lite/issues/2802");
|
||||
}
|
||||
curSplice[sline] = curSplice[sline].substring(0, curCol) + text + curSplice[sline].substring(curCol);
|
||||
curCol += text.length;
|
||||
}
|
||||
|
|
|
@ -292,6 +292,7 @@ function Ace2Inner(){
|
|||
{
|
||||
if ((typeof author) != "string")
|
||||
{
|
||||
top.console.error("Going to throw new error, potentially caused by: https://github.com/ether/etherpad-lite/issues/2802");
|
||||
throw new Error("setAuthorInfo: author (" + author + ") is not a string");
|
||||
}
|
||||
if (!info)
|
||||
|
|
|
@ -253,7 +253,15 @@ var undoModule = (function()
|
|||
}
|
||||
if (!merged)
|
||||
{
|
||||
stack.pushEvent(event);
|
||||
/*
|
||||
* Push the event on the undo stack only if it exists, and if it's
|
||||
* not a "clearauthorship". This disallows undoing the removal of the
|
||||
* authorship colors, but is a necessary stopgap measure against
|
||||
* https://github.com/ether/etherpad-lite/issues/2802
|
||||
*/
|
||||
if (event && (event.eventType !== "clearauthorship")) {
|
||||
stack.pushEvent(event);
|
||||
}
|
||||
}
|
||||
undoPtr = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue