mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
breaking: remove socket.emit('posts.delete')
remove socket.emit('posts.restore')
remove socket.emit('posts.purge')
remove socket.emit('posts.deletePosts')
remove socket.emit('posts.purgePosts')
This commit is contained in:
@@ -9,9 +9,6 @@ const plugins = require('../../plugins');
|
||||
const social = require('../../social');
|
||||
const user = require('../../user');
|
||||
const utils = require('../../utils');
|
||||
const api = require('../../api');
|
||||
|
||||
const sockets = require('..');
|
||||
|
||||
module.exports = function (SocketPosts) {
|
||||
SocketPosts.loadPostTools = async function (socket, data) {
|
||||
@@ -68,39 +65,6 @@ module.exports = function (SocketPosts) {
|
||||
return results;
|
||||
};
|
||||
|
||||
SocketPosts.delete = async function (socket, data) {
|
||||
sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid/state');
|
||||
await api.posts.delete(socket, data);
|
||||
};
|
||||
|
||||
SocketPosts.restore = async function (socket, data) {
|
||||
sockets.warnDeprecated(socket, 'PUT /api/v3/posts/:pid/state');
|
||||
await api.posts.restore(socket, data);
|
||||
};
|
||||
|
||||
SocketPosts.deletePosts = async function (socket, data) {
|
||||
await deletePurgePosts(socket, data, 'delete');
|
||||
};
|
||||
|
||||
SocketPosts.purgePosts = async function (socket, data) {
|
||||
await deletePurgePosts(socket, data, 'purge');
|
||||
};
|
||||
|
||||
async function deletePurgePosts(socket, data, command) {
|
||||
if (!data || !Array.isArray(data.pids)) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
for (const pid of data.pids) {
|
||||
/* eslint-disable no-await-in-loop */
|
||||
await SocketPosts[command](socket, { pid: pid });
|
||||
}
|
||||
}
|
||||
|
||||
SocketPosts.purge = async function (socket, data) {
|
||||
sockets.warnDeprecated(socket, 'DELETE /api/v3/posts/:pid');
|
||||
await api.posts.purge(socket, data);
|
||||
};
|
||||
|
||||
SocketPosts.changeOwner = async function (socket, data) {
|
||||
if (!data || !Array.isArray(data.pids) || !data.toUid) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
|
||||
Reference in New Issue
Block a user