mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
* fix: #9395, pass all data from client to Topics.reply so plugins can set custom fields refactor and use setDefaultPostData * fix: circular json error * refactor: change params
This commit is contained in:
committed by
GitHub
parent
33fbfdfe40
commit
a8f7b24452
@@ -10,6 +10,13 @@ const socketHelpers = require('../socket.io/helpers');
|
||||
const websockets = require('../socket.io');
|
||||
const events = require('../events');
|
||||
|
||||
exports.setDefaultPostData = function (reqOrSocket, data) {
|
||||
data.uid = reqOrSocket.uid;
|
||||
data.req = exports.buildReqObject(reqOrSocket, { ...data });
|
||||
data.timestamp = Date.now();
|
||||
data.fromQueue = false;
|
||||
};
|
||||
|
||||
// creates a slimmed down version of the request object
|
||||
exports.buildReqObject = (req, payload) => {
|
||||
req = req || {};
|
||||
|
||||
Reference in New Issue
Block a user