1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Update follower/following counts

This commit is contained in:
Chocobozzz 2018-01-12 11:47:45 +01:00
parent 6502c3d43e
commit 32b2b43c06
No known key found for this signature in database
GPG key ID: 583A612D890159BE
8 changed files with 108 additions and 1 deletions

View file

@ -264,6 +264,16 @@ export class ActorModel extends Model<ActorModel> {
return ActorModel.scope(ScopeNames.FULL).findOne(query)
}
static incrementFollows (id: number, column: 'followersCount' | 'followingCount', by: number) {
// FIXME: typings
return (ActorModel as any).increment(column, {
by,
where: {
id
}
})
}
toFormattedJSON () {
let avatar: Avatar = null
if (this.Avatar) {