]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/account.ts
Fix retrieving of deleted comments when subscribing to a new instance
[github/Chocobozzz/PeerTube.git] / server / models / account / account.ts
index 4cc731075dcb9730c1b968ebc3d88a08a6b8e1ce..a818a5a4dfd8b4d310184b456acdbe37e0e0f460 100644 (file)
@@ -32,7 +32,7 @@ import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequ
 import { AccountBlocklistModel } from './account-blocklist'
 import { ServerBlocklistModel } from '../server/server-blocklist'
 import { ActorFollowModel } from '../activitypub/actor-follow'
-import { MAccountActor, MAccountDefault } from '../../typings/models'
+import { MAccountActor, MAccountDefault, MAccountSummaryFormattable, MAccountFormattable, MAccountAP } from '../../typings/models'
 import * as Bluebird from 'bluebird'
 
 export enum ScopeNames {
@@ -201,7 +201,7 @@ export class AccountModel extends Model<AccountModel> {
 
   @HasMany(() => VideoCommentModel, {
     foreignKey: {
-      allowNull: false
+      allowNull: true
     },
     onDelete: 'cascade',
     hooks: true
@@ -353,7 +353,7 @@ export class AccountModel extends Model<AccountModel> {
       .findAll(query)
   }
 
-  toFormattedJSON (): Account {
+  toFormattedJSON (this: MAccountFormattable): Account {
     const actor = this.Actor.toFormattedJSON()
     const account = {
       id: this.id,
@@ -367,8 +367,8 @@ export class AccountModel extends Model<AccountModel> {
     return Object.assign(actor, account)
   }
 
-  toFormattedSummaryJSON (): AccountSummary {
-    const actor = this.Actor.toFormattedJSON()
+  toFormattedSummaryJSON (this: MAccountSummaryFormattable): AccountSummary {
+    const actor = this.Actor.toFormattedSummaryJSON()
 
     return {
       id: this.id,
@@ -380,8 +380,8 @@ export class AccountModel extends Model<AccountModel> {
     }
   }
 
-  toActivityPubObject () {
-    const obj = this.Actor.toActivityPubObject(this.name, 'Account')
+  toActivityPubObject (this: MAccountAP) {
+    const obj = this.Actor.toActivityPubObject(this.name)
 
     return Object.assign(obj, {
       summary: this.description