db/Pad.js: make "force" parameter non optional in Pad.prototype.copy()
This function was simulating two overloads: 1. copy(destinationID, force, callback) 2. copy(destinationID, callback), in this case "force" would be assumed false But all the call sites always used the version with arity 3. Thus, we can remove that optionality and always assume that the funcion will be called with three parameters. This will simplify future work.pull/3572/head
parent
1900b00ec2
commit
26f3f1bcd0
|
@ -454,15 +454,12 @@ Pad.prototype.copy = function copy(destinationID, force, callback) {
|
|||
var _this = this;
|
||||
var destGroupID;
|
||||
|
||||
// make force optional
|
||||
if (typeof force == "function") {
|
||||
callback = force;
|
||||
force = false;
|
||||
// allow force to be a string
|
||||
if (typeof force === "string") {
|
||||
force = (force.toLowerCase() === "true");
|
||||
} else {
|
||||
force = !!force;
|
||||
}
|
||||
else if (force == undefined || force.toLowerCase() != "true") {
|
||||
force = false;
|
||||
}
|
||||
else force = true;
|
||||
|
||||
// Kick everyone from this pad.
|
||||
// This was commented due to https://github.com/ether/etherpad-lite/issues/3183.
|
||||
|
|
Loading…
Reference in New Issue