diff options
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r-- | server/models/video/video-channel.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 40f3be7fe..4a50af265 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -108,7 +108,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
108 | foreignKey: { | 108 | foreignKey: { |
109 | allowNull: false | 109 | allowNull: false |
110 | }, | 110 | }, |
111 | onDelete: 'CASCADE' | 111 | hooks: true |
112 | }) | 112 | }) |
113 | Account: AccountModel | 113 | Account: AccountModel |
114 | 114 | ||
@@ -234,17 +234,26 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
234 | 234 | ||
235 | toFormattedJSON (): VideoChannel { | 235 | toFormattedJSON (): VideoChannel { |
236 | const actor = this.Actor.toFormattedJSON() | 236 | const actor = this.Actor.toFormattedJSON() |
237 | const account = { | 237 | const videoChannel = { |
238 | id: this.id, | 238 | id: this.id, |
239 | displayName: this.name, | 239 | displayName: this.name, |
240 | description: this.description, | 240 | description: this.description, |
241 | support: this.support, | 241 | support: this.support, |
242 | isLocal: this.Actor.isOwned(), | 242 | isLocal: this.Actor.isOwned(), |
243 | createdAt: this.createdAt, | 243 | createdAt: this.createdAt, |
244 | updatedAt: this.updatedAt | 244 | updatedAt: this.updatedAt, |
245 | ownerAccount: undefined, | ||
246 | videos: undefined | ||
247 | } | ||
248 | |||
249 | if (this.Account) { | ||
250 | videoChannel.ownerAccount = { | ||
251 | id: this.Account.id, | ||
252 | uuid: this.Account.Actor.uuid | ||
253 | } | ||
245 | } | 254 | } |
246 | 255 | ||
247 | return Object.assign(actor, account) | 256 | return Object.assign(actor, videoChannel) |
248 | } | 257 | } |
249 | 258 | ||
250 | toActivityPubObject (): ActivityPubActor { | 259 | toActivityPubObject (): ActivityPubActor { |