mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 22:23:33 +01:00
Pad: Return new rev number from appendRevision()
This commit is contained in:
parent
c05ee7ce72
commit
56b7671422
2 changed files with 6 additions and 10 deletions
|
@ -119,6 +119,7 @@ Pad.prototype.appendRevision = async function (aChangeset, author) {
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(p);
|
await Promise.all(p);
|
||||||
|
return newRev;
|
||||||
};
|
};
|
||||||
|
|
||||||
// save all attributes to the database
|
// save all attributes to the database
|
||||||
|
|
|
@ -639,8 +639,8 @@ const handleUserChanges = async (socket, message) => {
|
||||||
`${Changeset.oldLen(rebasedChangeset)} to document of length ${prevText.length}`);
|
`${Changeset.oldLen(rebasedChangeset)} to document of length ${prevText.length}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await pad.appendRevision(rebasedChangeset, thisSession.author);
|
const newRev = await pad.appendRevision(rebasedChangeset, thisSession.author);
|
||||||
assert.equal(pad.getHeadRevisionNumber(), r + 1);
|
assert.equal(newRev, r + 1);
|
||||||
|
|
||||||
const correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
|
const correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
|
||||||
if (correctionChangeset) {
|
if (correctionChangeset) {
|
||||||
|
@ -656,14 +656,9 @@ const handleUserChanges = async (socket, message) => {
|
||||||
// The client assumes that ACCEPT_COMMIT and NEW_CHANGES messages arrive in order. Make sure we
|
// The client assumes that ACCEPT_COMMIT and NEW_CHANGES messages arrive in order. Make sure we
|
||||||
// have already sent any previous ACCEPT_COMMIT and NEW_CHANGES messages.
|
// have already sent any previous ACCEPT_COMMIT and NEW_CHANGES messages.
|
||||||
assert.equal(thisSession.rev, r);
|
assert.equal(thisSession.rev, r);
|
||||||
socket.json.send({
|
socket.json.send({type: 'COLLABROOM', data: {type: 'ACCEPT_COMMIT', newRev}});
|
||||||
type: 'COLLABROOM',
|
thisSession.rev = newRev;
|
||||||
data: {
|
thisSession.time = await pad.getRevisionDate(newRev);
|
||||||
type: 'ACCEPT_COMMIT',
|
|
||||||
newRev: ++thisSession.rev,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
thisSession.time = await pad.getRevisionDate(thisSession.rev);
|
|
||||||
await exports.updatePadClients(pad);
|
await exports.updatePadClients(pad);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
socket.json.send({disconnect: 'badChangeset'});
|
socket.json.send({disconnect: 'badChangeset'});
|
||||||
|
|
Loading…
Reference in a new issue