mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
PadMessageHandler: Deprecate client
context property
This commit is contained in:
parent
8539a66439
commit
1b52c9f0c4
2 changed files with 14 additions and 1 deletions
|
@ -26,6 +26,7 @@ const ChatMessage = require('../../static/js/ChatMessage');
|
|||
const AttributePool = require('../../static/js/AttributePool');
|
||||
const AttributeManager = require('../../static/js/AttributeManager');
|
||||
const authorManager = require('../db/AuthorManager');
|
||||
const {padutils} = require('../../static/js/pad_utils');
|
||||
const readOnlyManager = require('../db/ReadOnlyManager');
|
||||
const settings = require('../utils/Settings');
|
||||
const securityManager = require('../db/SecurityManager');
|
||||
|
@ -270,7 +271,16 @@ exports.handleMessage = async (socket, message) => {
|
|||
thisSession.author = authorID;
|
||||
|
||||
// Allow plugins to bypass the readonly message blocker
|
||||
const context = {message, socket, client: socket}; // `client` for backwards compatibility.
|
||||
const context = {
|
||||
message,
|
||||
socket,
|
||||
get client() {
|
||||
padutils.warnDeprecated(
|
||||
'the `client` context property for the handleMessageSecurity and handleMessage hooks ' +
|
||||
'is deprecated; use the `socket` property instead');
|
||||
return this.socket;
|
||||
},
|
||||
};
|
||||
if ((await hooks.aCallAll('handleMessageSecurity', context)).some((w) => w === true)) {
|
||||
thisSession.readonly = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue