diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-12 11:47:45 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-12 11:47:45 +0100 |
commit | 32b2b43c06621e384c0bd1610ef0bb9f23399be7 (patch) | |
tree | c195943354838bcbe3b1993d77aaf0d3200fd19d /server/models/activitypub/actor.ts | |
parent | 6502c3d43e512e968ad49f5a3bc9abc302471e18 (diff) | |
download | PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.tar.gz PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.tar.zst PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.zip |
Update follower/following counts
Diffstat (limited to 'server/models/activitypub/actor.ts')
-rw-r--r-- | server/models/activitypub/actor.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 17f69f7a7..b7be9c32c 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -264,6 +264,16 @@ export class ActorModel extends Model<ActorModel> { | |||
264 | return ActorModel.scope(ScopeNames.FULL).findOne(query) | 264 | return ActorModel.scope(ScopeNames.FULL).findOne(query) |
265 | } | 265 | } |
266 | 266 | ||
267 | static incrementFollows (id: number, column: 'followersCount' | 'followingCount', by: number) { | ||
268 | // FIXME: typings | ||
269 | return (ActorModel as any).increment(column, { | ||
270 | by, | ||
271 | where: { | ||
272 | id | ||
273 | } | ||
274 | }) | ||
275 | } | ||
276 | |||
267 | toFormattedJSON () { | 277 | toFormattedJSON () { |
268 | let avatar: Avatar = null | 278 | let avatar: Avatar = null |
269 | if (this.Avatar) { | 279 | if (this.Avatar) { |