unFollowAll on suspend (#4490)

* unFollowAll on suspend

* use services

* silent
This commit is contained in:
MeiMei 2019-03-14 15:16:07 +09:00 committed by syuilo
parent b323a160e3
commit 1179920790
2 changed files with 25 additions and 3 deletions

View file

@ -13,7 +13,7 @@ import instanceChart from '../../services/chart/instance';
const logger = new Logger('following/delete');
export default async function(follower: IUser, followee: IUser) {
export default async function(follower: IUser, followee: IUser, silent = false) {
const following = await Following.findOne({
followerId: follower._id,
followeeId: followee._id
@ -71,7 +71,7 @@ export default async function(follower: IUser, followee: IUser) {
perUserFollowingChart.update(follower, followee, false);
// Publish unfollow event
if (isLocalUser(follower)) {
if (!silent && isLocalUser(follower)) {
packUser(followee, follower, {
detail: true
}).then(packed => publishMainStream(follower._id, 'unfollow', packed));