chat: Move chatHead initialization to padLoad hook

This commit is contained in:
Richard Hansen 2022-04-08 04:26:32 -04:00
parent 42c22ce28d
commit 01f1a8b75e
3 changed files with 5 additions and 1 deletions

View file

@ -26,6 +26,7 @@
"eejsBlock_stickyContainer": "ep_etherpad-lite/node/chat",
"handleMessage": "ep_etherpad-lite/node/chat",
"padCheck": "ep_etherpad-lite/node/chat",
"padLoad": "ep_etherpad-lite/node/chat",
"socketio": "ep_etherpad-lite/node/chat"
}
},

View file

@ -156,6 +156,10 @@ exports.padCheck = async (hookName, {pad}) => {
for (const p of chats.batch(100).buffer(99)) await p;
};
exports.padLoad = async (hookName, {pad}) => {
if (!('chatHead' in pad)) pad.chatHead = -1;
};
exports.socketio = (hookName, {io}) => {
socketio = io;
};

View file

@ -49,7 +49,6 @@ class Pad {
this.atext = Changeset.makeAText('\n');
this.pool = new AttributePool();
this.head = -1;
this.chatHead = -1;
this.publicStatus = false;
this.id = id;
this.savedRevisions = [];