mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-08 10:03:20 +02:00
breaking: remove socket.emit('topics.post')
remove socket.emit('topics.search')
remove socket.emit('topics.getTopic')
This commit is contained in:
@@ -16,11 +16,6 @@ require('./topics/infinitescroll')(SocketTopics);
|
||||
require('./topics/tags')(SocketTopics);
|
||||
require('./topics/merge')(SocketTopics);
|
||||
|
||||
SocketTopics.post = async function (socket, data) {
|
||||
sockets.warnDeprecated(socket, 'POST /api/v3/topics');
|
||||
return await api.topics.create(socket, data);
|
||||
};
|
||||
|
||||
SocketTopics.postcount = async function (socket, tid) {
|
||||
const canRead = await privileges.topics.can('topics:read', tid, socket.uid);
|
||||
if (!canRead) {
|
||||
@@ -82,22 +77,9 @@ SocketTopics.isFollowed = async function (socket, tid) {
|
||||
return isFollowing[0];
|
||||
};
|
||||
|
||||
SocketTopics.search = async function (socket, data) {
|
||||
sockets.warnDeprecated(socket, 'GET /api/search');
|
||||
if (!data) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
return await topics.search(data.tid, data.term);
|
||||
};
|
||||
|
||||
SocketTopics.isModerator = async function (socket, tid) {
|
||||
const cid = await topics.getTopicField(tid, 'cid');
|
||||
return await user.isModerator(socket.uid, cid);
|
||||
};
|
||||
|
||||
SocketTopics.getTopic = async function (socket, tid) {
|
||||
sockets.warnDeprecated(socket, 'GET /api/v3/topics/:tid');
|
||||
return await api.topics.get(socket, { tid });
|
||||
};
|
||||
|
||||
require('../promisify')(SocketTopics);
|
||||
|
||||
@@ -267,6 +267,9 @@ Topics.isLocked = async function (tid) {
|
||||
};
|
||||
|
||||
Topics.search = async function (tid, term) {
|
||||
if (!tid || !term) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
const result = await plugins.hooks.fire('filter:topic.search', {
|
||||
tid: tid,
|
||||
term: term,
|
||||
|
||||
Reference in New Issue
Block a user