feat: added POST and DELETE /api/v1/users/:uid/follow routes

This commit is contained in:
Julian Lam
2020-03-31 20:54:10 -04:00
parent 7aed174ebc
commit b5bbcbaeaa
5 changed files with 99 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ const userController = require('../controllers/user');
const privileges = require('../privileges');
const utils = require('../utils');
const flags = require('../flags');
const sockets = require('.');
const SocketUser = module.exports;
@@ -157,6 +158,8 @@ SocketUser.isFollowing = async function (socket, data) {
};
SocketUser.follow = async function (socket, data) {
sockets.warnDeprecated(socket, 'POST /api/v1/users/follow');
if (!socket.uid || !data) {
throw new Error('[[error:invalid-data]]');
}
@@ -179,6 +182,8 @@ SocketUser.follow = async function (socket, data) {
};
SocketUser.unfollow = async function (socket, data) {
sockets.warnDeprecated(socket, 'DELETE /api/v1/users/unfollow');
if (!socket.uid || !data) {
throw new Error('[[error:invalid-data]]');
}