mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 08:25:29 +02:00
refactor: remove sockets.reqFromSocket
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
const posts = require('../../posts');
|
||||
const user = require('../../user');
|
||||
const privileges = require('../../privileges');
|
||||
const apiHelpers = require('../../api/helpers');
|
||||
const websockets = require('..');
|
||||
|
||||
module.exports = function (SocketPosts) {
|
||||
@@ -55,7 +56,7 @@ module.exports = function (SocketPosts) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
|
||||
const edit = await posts.diffs.restore(data.pid, data.since, socket.uid, websockets.reqFromSocket(socket));
|
||||
const edit = await posts.diffs.restore(data.pid, data.since, socket.uid, apiHelpers.buildReqObject(socket));
|
||||
websockets.in('topic_' + edit.topic.tid).emit('event:post_edited', edit);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ const groups = require('../../groups');
|
||||
const events = require('../../events');
|
||||
const meta = require('../../meta');
|
||||
const utils = require('../../utils');
|
||||
const apiHelpers = require('../../api/helpers');
|
||||
const websockets = require('../index');
|
||||
|
||||
module.exports = function (SocketPosts) {
|
||||
@@ -34,7 +35,7 @@ module.exports = function (SocketPosts) {
|
||||
}
|
||||
|
||||
data.uid = socket.uid;
|
||||
data.req = websockets.reqFromSocket(socket);
|
||||
data.req = apiHelpers.buildReqObject(socket);
|
||||
|
||||
const editResult = await posts.edit(data);
|
||||
if (editResult.topic.renamed) {
|
||||
|
||||
Reference in New Issue
Block a user