mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
PadMessageHandler: Replace clientReady
hook with new userJoin
hook
This commit is contained in:
parent
c98910e1c5
commit
a6d060d67b
3 changed files with 39 additions and 18 deletions
|
@ -43,6 +43,8 @@ const webaccess = require('../hooks/express/webaccess');
|
|||
let rateLimiter;
|
||||
let socketio = null;
|
||||
|
||||
hooks.deprecationNotices.clientReady = 'use the userJoin hook instead';
|
||||
|
||||
exports.socketio = () => {
|
||||
// The rate limiter is created in this hook so that restarting the server resets the limiter. The
|
||||
// settings.commitRateLimiting object is passed directly to the rate limiter so that the limits
|
||||
|
@ -812,7 +814,7 @@ const handleClientReady = async (socket, message) => {
|
|||
sessionInfo.readonly =
|
||||
padIds.readonly || !webaccess.userCanModify(sessionInfo.auth.padID, socket.client.request);
|
||||
|
||||
await hooks.aCallAll('clientReady', message);
|
||||
await hooks.aCallAll('clientReady', message); // Deprecated due to awkward context.
|
||||
|
||||
// get all authordata of this new user
|
||||
assert(sessionInfo.author);
|
||||
|
@ -1088,6 +1090,15 @@ const handleClientReady = async (socket, message) => {
|
|||
|
||||
socket.json.send(msg);
|
||||
}));
|
||||
|
||||
await hooks.aCallAll('userJoin', {
|
||||
authorId: sessionInfo.author,
|
||||
displayName: authorName,
|
||||
padId: sessionInfo.padId,
|
||||
readOnly: sessionInfo.readonly,
|
||||
readOnlyPadId: sessionInfo.readOnlyPadId,
|
||||
socket,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue