diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-04-02 22:06:24 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-02 22:06:24 +0900 |
| commit | 5b80b6e901b3618b4cbce56e9f78fc8c11a0adb3 (patch) | |
| tree | 15bd5adf6a54ef6bd77ca87d2c5d94ed4802e415 /src/processor/http | |
| parent | Merge pull request #1373 from akihikodaki/misc (diff) | |
| parent | Introduce followed log and following log (diff) | |
| download | sharkey-5b80b6e901b3618b4cbce56e9f78fc8c11a0adb3.tar.gz sharkey-5b80b6e901b3618b4cbce56e9f78fc8c11a0adb3.tar.bz2 sharkey-5b80b6e901b3618b4cbce56e9f78fc8c11a0adb3.zip | |
Merge pull request #1374 from akihikodaki/log
Introduce followed log and following log
Diffstat (limited to 'src/processor/http')
| -rw-r--r-- | src/processor/http/follow.ts | 12 |
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), |