diff --git a/src/server/api/endpoints/following/create.ts b/src/server/api/endpoints/following/create.ts index 0a642f50b2..27e5eb31db 100644 --- a/src/server/api/endpoints/following/create.ts +++ b/src/server/api/endpoints/following/create.ts @@ -8,10 +8,6 @@ import create from '../../../../services/following/create'; /** * Follow a user - * - * @param {any} params - * @param {any} user - * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { const follower = user; diff --git a/src/server/api/endpoints/following/delete.ts b/src/server/api/endpoints/following/delete.ts index 0d0a6c7132..ca0703ca22 100644 --- a/src/server/api/endpoints/following/delete.ts +++ b/src/server/api/endpoints/following/delete.ts @@ -4,14 +4,10 @@ import $ from 'cafy'; import User from '../../../../models/user'; import Following from '../../../../models/following'; -import { createHttp } from '../../../../queue'; +import deleteFollowing from '../../../../services/following/delete'; /** * Unfollow a user - * - * @param {any} params - * @param {any} user - * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { const follower = user; @@ -49,15 +45,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => { return rej('already not following'); } - createHttp({ - type: 'unfollow', - id: exist._id - }).save(error => { - if (error) { - return rej('unfollow failed'); - } + // Delete following + deleteFollowing(follower, followee); - // Send response - res(); - }); + // Send response + res(); });