1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-01 07:35:57 +09:00

Fix #1437 and some clean ups

This commit is contained in:
syuilo 2018-04-10 21:47:56 +09:00
parent 16b070b926
commit 4ec94696fe
2 changed files with 5 additions and 19 deletions

View File

@ -8,10 +8,6 @@ import create from '../../../../services/following/create';
/**
* Follow a user
*
* @param {any} params
* @param {any} user
* @return {Promise<any>}
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
const follower = user;

View File

@ -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<any>}
*/
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();
});