summaryrefslogtreecommitdiff
path: root/src/processor/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/processor/http')
-rw-r--r--src/processor/http/follow.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/processor/http/follow.ts b/src/processor/http/follow.ts
index 7ec1ee6756..29ac9fa552 100644
--- a/src/processor/http/follow.ts
+++ b/src/processor/http/follow.ts
@@ -3,6 +3,8 @@ import { sign } from 'http-signature';
import { URL } from 'url';
import User, { isLocalUser, pack as packUser } from '../../models/user';
import Following from '../../models/following';
+import FollowingLog from '../../models/following-log';
+import FollowedLog from '../../models/followed-log';
import event from '../../publishers/stream';
import notify from '../../publishers/notify';
import context from '../../remote/activitypub/renderer/context';
@@ -21,6 +23,11 @@ export default ({ data }, done) => Following.findOne({ _id: data.following }).th
}
}),
+ promisedFollower.then(({ followingCount }) => FollowingLog.insert({
+ userId: followerId,
+ count: followingCount + 1
+ })),
+
// Increment followers count
User.update({ _id: followeeId }, {
$inc: {
@@ -28,6 +35,11 @@ export default ({ data }, done) => Following.findOne({ _id: data.following }).th
}
}),
+ promisedFollowee.then(({ followersCount }) => FollowedLog.insert({
+ userId: followerId,
+ count: followersCount + 1
+ })),
+
// Notify
promisedFollowee.then(followee => followee.host === null ?
notify(followeeId, followerId, 'follow') : null),