mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-16 01:55:44 +01:00
Fix #1437 and some clean ups
This commit is contained in:
parent
16b070b926
commit
4ec94696fe
2 changed files with 5 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue