]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/video/video-channel.ts
Translated using Weblate (Vietnamese)
[github/Chocobozzz/PeerTube.git] / server / models / video / video-channel.ts
1 import { FindOptions, Includeable, literal, Op, QueryTypes, ScopeOptions, Transaction, WhereOptions } from 'sequelize'
2 import {
3 AllowNull,
4 BeforeDestroy,
5 BelongsTo,
6 Column,
7 CreatedAt,
8 DataType,
9 Default,
10 DefaultScope,
11 ForeignKey,
12 HasMany,
13 Is,
14 Model,
15 Scopes,
16 Sequelize,
17 Table,
18 UpdatedAt
19 } from 'sequelize-typescript'
20 import { CONFIG } from '@server/initializers/config'
21 import { MAccountActor } from '@server/types/models'
22 import { forceNumber, pick } from '@shared/core-utils'
23 import { AttributesOnly } from '@shared/typescript-utils'
24 import { ActivityPubActor } from '../../../shared/models/activitypub'
25 import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos'
26 import {
27 isVideoChannelDescriptionValid,
28 isVideoChannelDisplayNameValid,
29 isVideoChannelSupportValid
30 } from '../../helpers/custom-validators/video-channels'
31 import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
32 import { sendDeleteActor } from '../../lib/activitypub/send'
33 import {
34 MChannel,
35 MChannelActor,
36 MChannelAP,
37 MChannelBannerAccountDefault,
38 MChannelFormattable,
39 MChannelSummaryFormattable
40 } from '../../types/models/video'
41 import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'
42 import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
43 import { ActorFollowModel } from '../actor/actor-follow'
44 import { ActorImageModel } from '../actor/actor-image'
45 import { ServerModel } from '../server/server'
46 import {
47 buildServerIdsFollowedBy,
48 buildTrigramSearchIndex,
49 createSimilarityAttribute,
50 getSort,
51 setAsUpdated,
52 throwIfNotValid
53 } from '../shared'
54 import { VideoModel } from './video'
55 import { VideoPlaylistModel } from './video-playlist'
56
57 export enum ScopeNames {
58 FOR_API = 'FOR_API',
59 SUMMARY = 'SUMMARY',
60 WITH_ACCOUNT = 'WITH_ACCOUNT',
61 WITH_ACTOR = 'WITH_ACTOR',
62 WITH_ACTOR_BANNER = 'WITH_ACTOR_BANNER',
63 WITH_VIDEOS = 'WITH_VIDEOS',
64 WITH_STATS = 'WITH_STATS'
65 }
66
67 type AvailableForListOptions = {
68 actorId: number
69 search?: string
70 host?: string
71 handles?: string[]
72 forCount?: boolean
73 }
74
75 type AvailableWithStatsOptions = {
76 daysPrior: number
77 }
78
79 export type SummaryOptions = {
80 actorRequired?: boolean // Default: true
81 withAccount?: boolean // Default: false
82 withAccountBlockerIds?: number[]
83 }
84
85 @DefaultScope(() => ({
86 include: [
87 {
88 model: ActorModel,
89 required: true
90 }
91 ]
92 }))
93 @Scopes(() => ({
94 [ScopeNames.FOR_API]: (options: AvailableForListOptions) => {
95 // Only list local channels OR channels that are on an instance followed by actorId
96 const inQueryInstanceFollow = buildServerIdsFollowedBy(options.actorId)
97
98 const whereActorAnd: WhereOptions[] = [
99 {
100 [Op.or]: [
101 {
102 serverId: null
103 },
104 {
105 serverId: {
106 [Op.in]: Sequelize.literal(inQueryInstanceFollow)
107 }
108 }
109 ]
110 }
111 ]
112
113 let serverRequired = false
114 let whereServer: WhereOptions
115
116 if (options.host && options.host !== WEBSERVER.HOST) {
117 serverRequired = true
118 whereServer = { host: options.host }
119 }
120
121 if (options.host === WEBSERVER.HOST) {
122 whereActorAnd.push({
123 serverId: null
124 })
125 }
126
127 if (Array.isArray(options.handles) && options.handles.length !== 0) {
128 const or: string[] = []
129
130 for (const handle of options.handles || []) {
131 const [ preferredUsername, host ] = handle.split('@')
132
133 const sanitizedPreferredUsername = VideoChannelModel.sequelize.escape(preferredUsername.toLowerCase())
134 const sanitizedHost = VideoChannelModel.sequelize.escape(host)
135
136 if (!host || host === WEBSERVER.HOST) {
137 or.push(`(LOWER("preferredUsername") = ${sanitizedPreferredUsername} AND "serverId" IS NULL)`)
138 } else {
139 or.push(
140 `(` +
141 `LOWER("preferredUsername") = ${sanitizedPreferredUsername} ` +
142 `AND "host" = ${sanitizedHost}` +
143 `)`
144 )
145 }
146 }
147
148 whereActorAnd.push({
149 id: {
150 [Op.in]: literal(`(SELECT "actor".id FROM actor LEFT JOIN server on server.id = actor."serverId" WHERE ${or.join(' OR ')})`)
151 }
152 })
153 }
154
155 const channelActorInclude: Includeable[] = []
156 const accountActorInclude: Includeable[] = []
157
158 if (options.forCount !== true) {
159 accountActorInclude.push({
160 model: ServerModel,
161 required: false
162 })
163
164 accountActorInclude.push({
165 model: ActorImageModel,
166 as: 'Avatars',
167 required: false
168 })
169
170 channelActorInclude.push({
171 model: ActorImageModel,
172 as: 'Avatars',
173 required: false
174 })
175
176 channelActorInclude.push({
177 model: ActorImageModel,
178 as: 'Banners',
179 required: false
180 })
181 }
182
183 if (options.forCount !== true || serverRequired) {
184 channelActorInclude.push({
185 model: ServerModel,
186 duplicating: false,
187 required: serverRequired,
188 where: whereServer
189 })
190 }
191
192 return {
193 include: [
194 {
195 attributes: {
196 exclude: unusedActorAttributesForAPI
197 },
198 model: ActorModel.unscoped(),
199 where: {
200 [Op.and]: whereActorAnd
201 },
202 include: channelActorInclude
203 },
204 {
205 model: AccountModel.unscoped(),
206 required: true,
207 include: [
208 {
209 attributes: {
210 exclude: unusedActorAttributesForAPI
211 },
212 model: ActorModel.unscoped(),
213 required: true,
214 include: accountActorInclude
215 }
216 ]
217 }
218 ]
219 }
220 },
221 [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {
222 const include: Includeable[] = [
223 {
224 attributes: [ 'id', 'preferredUsername', 'url', 'serverId' ],
225 model: ActorModel.unscoped(),
226 required: options.actorRequired ?? true,
227 include: [
228 {
229 attributes: [ 'host' ],
230 model: ServerModel.unscoped(),
231 required: false
232 },
233 {
234 model: ActorImageModel,
235 as: 'Avatars',
236 required: false
237 }
238 ]
239 }
240 ]
241
242 const base: FindOptions = {
243 attributes: [ 'id', 'name', 'description', 'actorId' ]
244 }
245
246 if (options.withAccount === true) {
247 include.push({
248 model: AccountModel.scope({
249 method: [ AccountModelScopeNames.SUMMARY, { withAccountBlockerIds: options.withAccountBlockerIds } as AccountSummaryOptions ]
250 }),
251 required: true
252 })
253 }
254
255 base.include = include
256
257 return base
258 },
259 [ScopeNames.WITH_ACCOUNT]: {
260 include: [
261 {
262 model: AccountModel,
263 required: true
264 }
265 ]
266 },
267 [ScopeNames.WITH_ACTOR]: {
268 include: [
269 ActorModel
270 ]
271 },
272 [ScopeNames.WITH_ACTOR_BANNER]: {
273 include: [
274 {
275 model: ActorModel,
276 include: [
277 {
278 model: ActorImageModel,
279 required: false,
280 as: 'Banners'
281 }
282 ]
283 }
284 ]
285 },
286 [ScopeNames.WITH_VIDEOS]: {
287 include: [
288 VideoModel
289 ]
290 },
291 [ScopeNames.WITH_STATS]: (options: AvailableWithStatsOptions = { daysPrior: 30 }) => {
292 const daysPrior = forceNumber(options.daysPrior)
293
294 return {
295 attributes: {
296 include: [
297 [
298 literal('(SELECT COUNT(*) FROM "video" WHERE "channelId" = "VideoChannelModel"."id")'),
299 'videosCount'
300 ],
301 [
302 literal(
303 '(' +
304 `SELECT string_agg(concat_ws('|', t.day, t.views), ',') ` +
305 'FROM ( ' +
306 'WITH ' +
307 'days AS ( ' +
308 `SELECT generate_series(date_trunc('day', now()) - '${daysPrior} day'::interval, ` +
309 `date_trunc('day', now()), '1 day'::interval) AS day ` +
310 ') ' +
311 'SELECT days.day AS day, COALESCE(SUM("videoView".views), 0) AS views ' +
312 'FROM days ' +
313 'LEFT JOIN (' +
314 '"videoView" INNER JOIN "video" ON "videoView"."videoId" = "video"."id" ' +
315 'AND "video"."channelId" = "VideoChannelModel"."id"' +
316 `) ON date_trunc('day', "videoView"."startDate") = date_trunc('day', days.day) ` +
317 'GROUP BY day ' +
318 'ORDER BY day ' +
319 ') t' +
320 ')'
321 ),
322 'viewsPerDay'
323 ],
324 [
325 literal(
326 '(' +
327 'SELECT COALESCE(SUM("video".views), 0) AS totalViews ' +
328 'FROM "video" ' +
329 'WHERE "video"."channelId" = "VideoChannelModel"."id"' +
330 ')'
331 ),
332 'totalViews'
333 ]
334 ]
335 }
336 }
337 }
338 }))
339 @Table({
340 tableName: 'videoChannel',
341 indexes: [
342 buildTrigramSearchIndex('video_channel_name_trigram', 'name'),
343
344 {
345 fields: [ 'accountId' ]
346 },
347 {
348 fields: [ 'actorId' ]
349 }
350 ]
351 })
352 export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannelModel>>> {
353
354 @AllowNull(false)
355 @Is('VideoChannelName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'name'))
356 @Column
357 name: string
358
359 @AllowNull(true)
360 @Default(null)
361 @Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description', true))
362 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.DESCRIPTION.max))
363 description: string
364
365 @AllowNull(true)
366 @Default(null)
367 @Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support', true))
368 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
369 support: string
370
371 @CreatedAt
372 createdAt: Date
373
374 @UpdatedAt
375 updatedAt: Date
376
377 @ForeignKey(() => ActorModel)
378 @Column
379 actorId: number
380
381 @BelongsTo(() => ActorModel, {
382 foreignKey: {
383 allowNull: false
384 },
385 onDelete: 'cascade'
386 })
387 Actor: ActorModel
388
389 @ForeignKey(() => AccountModel)
390 @Column
391 accountId: number
392
393 @BelongsTo(() => AccountModel, {
394 foreignKey: {
395 allowNull: false
396 }
397 })
398 Account: AccountModel
399
400 @HasMany(() => VideoModel, {
401 foreignKey: {
402 name: 'channelId',
403 allowNull: false
404 },
405 onDelete: 'CASCADE',
406 hooks: true
407 })
408 Videos: VideoModel[]
409
410 @HasMany(() => VideoPlaylistModel, {
411 foreignKey: {
412 allowNull: true
413 },
414 onDelete: 'CASCADE',
415 hooks: true
416 })
417 VideoPlaylists: VideoPlaylistModel[]
418
419 @BeforeDestroy
420 static async sendDeleteIfOwned (instance: VideoChannelModel, options) {
421 if (!instance.Actor) {
422 instance.Actor = await instance.$get('Actor', { transaction: options.transaction })
423 }
424
425 await ActorFollowModel.removeFollowsOf(instance.Actor.id, options.transaction)
426
427 if (instance.Actor.isOwned()) {
428 return sendDeleteActor(instance.Actor, options.transaction)
429 }
430
431 return undefined
432 }
433
434 static countByAccount (accountId: number) {
435 const query = {
436 where: {
437 accountId
438 }
439 }
440
441 return VideoChannelModel.unscoped().count(query)
442 }
443
444 static async getStats () {
445
446 function getLocalVideoChannelStats (days?: number) {
447 const options = {
448 type: QueryTypes.SELECT as QueryTypes.SELECT,
449 raw: true
450 }
451
452 const videoJoin = days
453 ? `INNER JOIN "video" AS "Videos" ON "VideoChannelModel"."id" = "Videos"."channelId" ` +
454 `AND ("Videos"."publishedAt" > Now() - interval '${days}d')`
455 : ''
456
457 const query = `
458 SELECT COUNT(DISTINCT("VideoChannelModel"."id")) AS "count"
459 FROM "videoChannel" AS "VideoChannelModel"
460 ${videoJoin}
461 INNER JOIN "account" AS "Account" ON "VideoChannelModel"."accountId" = "Account"."id"
462 INNER JOIN "actor" AS "Account->Actor" ON "Account"."actorId" = "Account->Actor"."id"
463 AND "Account->Actor"."serverId" IS NULL`
464
465 return VideoChannelModel.sequelize.query<{ count: string }>(query, options)
466 .then(r => parseInt(r[0].count, 10))
467 }
468
469 const totalLocalVideoChannels = await getLocalVideoChannelStats()
470 const totalLocalDailyActiveVideoChannels = await getLocalVideoChannelStats(1)
471 const totalLocalWeeklyActiveVideoChannels = await getLocalVideoChannelStats(7)
472 const totalLocalMonthlyActiveVideoChannels = await getLocalVideoChannelStats(30)
473 const totalLocalHalfYearActiveVideoChannels = await getLocalVideoChannelStats(180)
474
475 return {
476 totalLocalVideoChannels,
477 totalLocalDailyActiveVideoChannels,
478 totalLocalWeeklyActiveVideoChannels,
479 totalLocalMonthlyActiveVideoChannels,
480 totalLocalHalfYearActiveVideoChannels
481 }
482 }
483
484 static listLocalsForSitemap (sort: string): Promise<MChannelActor[]> {
485 const query = {
486 attributes: [ ],
487 offset: 0,
488 order: getSort(sort),
489 include: [
490 {
491 attributes: [ 'preferredUsername', 'serverId' ],
492 model: ActorModel.unscoped(),
493 where: {
494 serverId: null
495 }
496 }
497 ]
498 }
499
500 return VideoChannelModel
501 .unscoped()
502 .findAll(query)
503 }
504
505 static listForApi (parameters: Pick<AvailableForListOptions, 'actorId'> & {
506 start: number
507 count: number
508 sort: string
509 }) {
510 const { actorId } = parameters
511
512 const query = {
513 offset: parameters.start,
514 limit: parameters.count,
515 order: getSort(parameters.sort)
516 }
517
518 const getScope = (forCount: boolean) => {
519 return { method: [ ScopeNames.FOR_API, { actorId, forCount } as AvailableForListOptions ] }
520 }
521
522 return Promise.all([
523 VideoChannelModel.scope(getScope(true)).count(),
524 VideoChannelModel.scope(getScope(false)).findAll(query)
525 ]).then(([ total, data ]) => ({ total, data }))
526 }
527
528 static searchForApi (options: Pick<AvailableForListOptions, 'actorId' | 'search' | 'host' | 'handles'> & {
529 start: number
530 count: number
531 sort: string
532 }) {
533 let attributesInclude: any[] = [ literal('0 as similarity') ]
534 let where: WhereOptions
535
536 if (options.search) {
537 const escapedSearch = VideoChannelModel.sequelize.escape(options.search)
538 const escapedLikeSearch = VideoChannelModel.sequelize.escape('%' + options.search + '%')
539 attributesInclude = [ createSimilarityAttribute('VideoChannelModel.name', options.search) ]
540
541 where = {
542 [Op.or]: [
543 Sequelize.literal(
544 'lower(immutable_unaccent("VideoChannelModel"."name")) % lower(immutable_unaccent(' + escapedSearch + '))'
545 ),
546 Sequelize.literal(
547 'lower(immutable_unaccent("VideoChannelModel"."name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))'
548 )
549 ]
550 }
551 }
552
553 const query = {
554 attributes: {
555 include: attributesInclude
556 },
557 offset: options.start,
558 limit: options.count,
559 order: getSort(options.sort),
560 where
561 }
562
563 const getScope = (forCount: boolean) => {
564 return {
565 method: [
566 ScopeNames.FOR_API, {
567 ...pick(options, [ 'actorId', 'host', 'handles' ]),
568
569 forCount
570 } as AvailableForListOptions
571 ]
572 }
573 }
574
575 return Promise.all([
576 VideoChannelModel.scope(getScope(true)).count(query),
577 VideoChannelModel.scope(getScope(false)).findAll(query)
578 ]).then(([ total, data ]) => ({ total, data }))
579 }
580
581 static listByAccountForAPI (options: {
582 accountId: number
583 start: number
584 count: number
585 sort: string
586 withStats?: boolean
587 search?: string
588 }) {
589 const escapedSearch = VideoModel.sequelize.escape(options.search)
590 const escapedLikeSearch = VideoModel.sequelize.escape('%' + options.search + '%')
591 const where = options.search
592 ? {
593 [Op.or]: [
594 Sequelize.literal(
595 'lower(immutable_unaccent("VideoChannelModel"."name")) % lower(immutable_unaccent(' + escapedSearch + '))'
596 ),
597 Sequelize.literal(
598 'lower(immutable_unaccent("VideoChannelModel"."name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))'
599 )
600 ]
601 }
602 : null
603
604 const getQuery = (forCount: boolean) => {
605 const accountModel = forCount
606 ? AccountModel.unscoped()
607 : AccountModel
608
609 return {
610 offset: options.start,
611 limit: options.count,
612 order: getSort(options.sort),
613 include: [
614 {
615 model: accountModel,
616 where: {
617 id: options.accountId
618 },
619 required: true
620 }
621 ],
622 where
623 }
624 }
625
626 const findScopes: string | ScopeOptions | (string | ScopeOptions)[] = [ ScopeNames.WITH_ACTOR_BANNER ]
627
628 if (options.withStats === true) {
629 findScopes.push({
630 method: [ ScopeNames.WITH_STATS, { daysPrior: 30 } as AvailableWithStatsOptions ]
631 })
632 }
633
634 return Promise.all([
635 VideoChannelModel.unscoped().count(getQuery(true)),
636 VideoChannelModel.scope(findScopes).findAll(getQuery(false))
637 ]).then(([ total, data ]) => ({ total, data }))
638 }
639
640 static listAllByAccount (accountId: number): Promise<MChannel[]> {
641 const query = {
642 limit: CONFIG.VIDEO_CHANNELS.MAX_PER_USER,
643 include: [
644 {
645 attributes: [],
646 model: AccountModel.unscoped(),
647 where: {
648 id: accountId
649 },
650 required: true
651 }
652 ]
653 }
654
655 return VideoChannelModel.findAll(query)
656 }
657
658 static loadAndPopulateAccount (id: number, transaction?: Transaction): Promise<MChannelBannerAccountDefault> {
659 return VideoChannelModel.unscoped()
660 .scope([ ScopeNames.WITH_ACTOR_BANNER, ScopeNames.WITH_ACCOUNT ])
661 .findByPk(id, { transaction })
662 }
663
664 static loadByUrlAndPopulateAccount (url: string): Promise<MChannelBannerAccountDefault> {
665 const query = {
666 include: [
667 {
668 model: ActorModel,
669 required: true,
670 where: {
671 url
672 },
673 include: [
674 {
675 model: ActorImageModel,
676 required: false,
677 as: 'Banners'
678 }
679 ]
680 }
681 ]
682 }
683
684 return VideoChannelModel
685 .scope([ ScopeNames.WITH_ACCOUNT ])
686 .findOne(query)
687 }
688
689 static loadByNameWithHostAndPopulateAccount (nameWithHost: string) {
690 const [ name, host ] = nameWithHost.split('@')
691
692 if (!host || host === WEBSERVER.HOST) return VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
693
694 return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host)
695 }
696
697 static loadLocalByNameAndPopulateAccount (name: string): Promise<MChannelBannerAccountDefault> {
698 const query = {
699 include: [
700 {
701 model: ActorModel,
702 required: true,
703 where: {
704 [Op.and]: [
705 ActorModel.wherePreferredUsername(name, 'Actor.preferredUsername'),
706 { serverId: null }
707 ]
708 },
709 include: [
710 {
711 model: ActorImageModel,
712 required: false,
713 as: 'Banners'
714 }
715 ]
716 }
717 ]
718 }
719
720 return VideoChannelModel.unscoped()
721 .scope([ ScopeNames.WITH_ACCOUNT ])
722 .findOne(query)
723 }
724
725 static loadByNameAndHostAndPopulateAccount (name: string, host: string): Promise<MChannelBannerAccountDefault> {
726 const query = {
727 include: [
728 {
729 model: ActorModel,
730 required: true,
731 where: ActorModel.wherePreferredUsername(name, 'Actor.preferredUsername'),
732 include: [
733 {
734 model: ServerModel,
735 required: true,
736 where: { host }
737 },
738 {
739 model: ActorImageModel,
740 required: false,
741 as: 'Banners'
742 }
743 ]
744 }
745 ]
746 }
747
748 return VideoChannelModel.unscoped()
749 .scope([ ScopeNames.WITH_ACCOUNT ])
750 .findOne(query)
751 }
752
753 toFormattedSummaryJSON (this: MChannelSummaryFormattable): VideoChannelSummary {
754 const actor = this.Actor.toFormattedSummaryJSON()
755
756 return {
757 id: this.id,
758 name: actor.name,
759 displayName: this.getDisplayName(),
760 url: actor.url,
761 host: actor.host,
762 avatars: actor.avatars,
763
764 // TODO: remove, deprecated in 4.2
765 avatar: actor.avatar
766 }
767 }
768
769 toFormattedJSON (this: MChannelFormattable): VideoChannel {
770 const viewsPerDayString = this.get('viewsPerDay') as string
771 const videosCount = this.get('videosCount') as number
772
773 let viewsPerDay: { date: Date, views: number }[]
774
775 if (viewsPerDayString) {
776 viewsPerDay = viewsPerDayString.split(',')
777 .map(v => {
778 const [ dateString, amount ] = v.split('|')
779
780 return {
781 date: new Date(dateString),
782 views: +amount
783 }
784 })
785 }
786
787 const totalViews = this.get('totalViews') as number
788
789 const actor = this.Actor.toFormattedJSON()
790 const videoChannel = {
791 id: this.id,
792 displayName: this.getDisplayName(),
793 description: this.description,
794 support: this.support,
795 isLocal: this.Actor.isOwned(),
796 updatedAt: this.updatedAt,
797
798 ownerAccount: undefined,
799
800 videosCount,
801 viewsPerDay,
802 totalViews,
803
804 avatars: actor.avatars,
805
806 // TODO: remove, deprecated in 4.2
807 avatar: actor.avatar
808 }
809
810 if (this.Account) videoChannel.ownerAccount = this.Account.toFormattedJSON()
811
812 return Object.assign(actor, videoChannel)
813 }
814
815 async toActivityPubObject (this: MChannelAP): Promise<ActivityPubActor> {
816 const obj = await this.Actor.toActivityPubObject(this.name)
817
818 return Object.assign(obj, {
819 summary: this.description,
820 support: this.support,
821 attributedTo: [
822 {
823 type: 'Person' as 'Person',
824 id: this.Account.Actor.url
825 }
826 ]
827 })
828 }
829
830 getLocalUrl (this: MAccountActor | MChannelActor) {
831 return WEBSERVER.URL + `/video-channels/` + this.Actor.preferredUsername
832 }
833
834 getDisplayName () {
835 return this.name
836 }
837
838 isOutdated () {
839 return this.Actor.isOutdated()
840 }
841
842 setAsUpdated (transaction?: Transaction) {
843 return setAsUpdated({ sequelize: this.sequelize, table: 'videoChannel', id: this.id, transaction })
844 }
845 }