MCPcopy Index your code
hub / github.com/ether/etherpad / handleChangesetRequest

Function handleChangesetRequest

src/node/handler/PadMessageHandler.ts:1530–1545  ·  view source on GitHub ↗
(socket:any, {data: {granularity, start, requestID}}: ChangesetRequest)

Source from the content-addressed store, hash-verified

1528 * Handles a request for a rough changeset, the timeslider client needs it
1529 */
1530const handleChangesetRequest = async (socket:any, {data: {granularity, start, requestID}}: ChangesetRequest) => {
1531 if (granularity == null) throw new Error('missing granularity');
1532 if (!Number.isInteger(granularity)) throw new Error('granularity is not an integer');
1533 if (start == null) throw new Error('missing start');
1534 start = checkValidRev(start);
1535 if (requestID == null) throw new Error('mising requestID');
1536 const end = start + (100 * granularity);
1537 const {padId, author: authorId} = sessioninfos[socket.id];
1538 const pad = await padManager.getPad(padId, null, authorId);
1539 const headRev = pad.getHeadRevisionNumber();
1540 if (start > headRev)
1541 start = headRev;
1542 const data:MapArrayType<any> = await getChangesetInfo(pad, start, end, granularity);
1543 data.requestID = requestID;
1544 socket.emit('message', {type: 'CHANGESET_REQ', data});
1545};
1546
1547/**
1548 * Tries to rebuild the getChangestInfo function of the original Etherpad

Callers 1

Calls 3

checkValidRevFunction · 0.85
getChangesetInfoFunction · 0.85
getHeadRevisionNumberMethod · 0.80

Tested by

no test coverage detected