aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user-notification.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-03 09:33:05 +0100
committerChocobozzz <me@florianbigard.com>2021-02-03 09:45:08 +0100
commitba5a8d89bbf049e4afc41543bcc072cccdb02669 (patch)
tree6cc6b2dca17745cc0824c7ad4515f3bc4883fa4a /server/models/account/user-notification.ts
parent29f148a61381727a432c22a71c7a2b7cc23d9c9e (diff)
downloadPeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.tar.gz
PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.tar.zst
PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.zip
Update server dependencies
Diffstat (limited to 'server/models/account/user-notification.ts')
-rw-r--r--server/models/account/user-notification.ts94
1 files changed, 52 insertions, 42 deletions
diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.ts
index 52b792a5b..add129644 100644
--- a/server/models/account/user-notification.ts
+++ b/server/models/account/user-notification.ts
@@ -469,27 +469,33 @@ export class UserNotificationModel extends Model {
469 ? Object.assign(this.formatVideo(this.Video), { channel: this.formatActor(this.Video.VideoChannel) }) 469 ? Object.assign(this.formatVideo(this.Video), { channel: this.formatActor(this.Video.VideoChannel) })
470 : undefined 470 : undefined
471 471
472 const videoImport = this.VideoImport ? { 472 const videoImport = this.VideoImport
473 id: this.VideoImport.id, 473 ? {
474 video: this.VideoImport.Video ? this.formatVideo(this.VideoImport.Video) : undefined, 474 id: this.VideoImport.id,
475 torrentName: this.VideoImport.torrentName, 475 video: this.VideoImport.Video ? this.formatVideo(this.VideoImport.Video) : undefined,
476 magnetUri: this.VideoImport.magnetUri, 476 torrentName: this.VideoImport.torrentName,
477 targetUrl: this.VideoImport.targetUrl 477 magnetUri: this.VideoImport.magnetUri,
478 } : undefined 478 targetUrl: this.VideoImport.targetUrl
479 479 }
480 const comment = this.Comment ? { 480 : undefined
481 id: this.Comment.id, 481
482 threadId: this.Comment.getThreadId(), 482 const comment = this.Comment
483 account: this.formatActor(this.Comment.Account), 483 ? {
484 video: this.formatVideo(this.Comment.Video) 484 id: this.Comment.id,
485 } : undefined 485 threadId: this.Comment.getThreadId(),
486 account: this.formatActor(this.Comment.Account),
487 video: this.formatVideo(this.Comment.Video)
488 }
489 : undefined
486 490
487 const abuse = this.Abuse ? this.formatAbuse(this.Abuse) : undefined 491 const abuse = this.Abuse ? this.formatAbuse(this.Abuse) : undefined
488 492
489 const videoBlacklist = this.VideoBlacklist ? { 493 const videoBlacklist = this.VideoBlacklist
490 id: this.VideoBlacklist.id, 494 ? {
491 video: this.formatVideo(this.VideoBlacklist.Video) 495 id: this.VideoBlacklist.id,
492 } : undefined 496 video: this.formatVideo(this.VideoBlacklist.Video)
497 }
498 : undefined
493 499
494 const account = this.Account ? this.formatActor(this.Account) : undefined 500 const account = this.Account ? this.formatActor(this.Account) : undefined
495 501
@@ -498,23 +504,25 @@ export class UserNotificationModel extends Model {
498 Group: 'channel' as 'channel', 504 Group: 'channel' as 'channel',
499 Person: 'account' as 'account' 505 Person: 'account' as 'account'
500 } 506 }
501 const actorFollow = this.ActorFollow ? { 507 const actorFollow = this.ActorFollow
502 id: this.ActorFollow.id, 508 ? {
503 state: this.ActorFollow.state, 509 id: this.ActorFollow.id,
504 follower: { 510 state: this.ActorFollow.state,
505 id: this.ActorFollow.ActorFollower.Account.id, 511 follower: {
506 displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(), 512 id: this.ActorFollow.ActorFollower.Account.id,
507 name: this.ActorFollow.ActorFollower.preferredUsername, 513 displayName: this.ActorFollow.ActorFollower.Account.getDisplayName(),
508 avatar: this.ActorFollow.ActorFollower.Avatar ? { path: this.ActorFollow.ActorFollower.Avatar.getStaticPath() } : undefined, 514 name: this.ActorFollow.ActorFollower.preferredUsername,
509 host: this.ActorFollow.ActorFollower.getHost() 515 avatar: this.ActorFollow.ActorFollower.Avatar ? { path: this.ActorFollow.ActorFollower.Avatar.getStaticPath() } : undefined,
510 }, 516 host: this.ActorFollow.ActorFollower.getHost()
511 following: { 517 },
512 type: actorFollowingType[this.ActorFollow.ActorFollowing.type], 518 following: {
513 displayName: (this.ActorFollow.ActorFollowing.VideoChannel || this.ActorFollow.ActorFollowing.Account).getDisplayName(), 519 type: actorFollowingType[this.ActorFollow.ActorFollowing.type],
514 name: this.ActorFollow.ActorFollowing.preferredUsername, 520 displayName: (this.ActorFollow.ActorFollowing.VideoChannel || this.ActorFollow.ActorFollowing.Account).getDisplayName(),
515 host: this.ActorFollow.ActorFollowing.getHost() 521 name: this.ActorFollow.ActorFollowing.preferredUsername,
522 host: this.ActorFollow.ActorFollowing.getHost()
523 }
516 } 524 }
517 } : undefined 525 : undefined
518 526
519 return { 527 return {
520 id: this.id, 528 id: this.id,
@@ -541,15 +549,17 @@ export class UserNotificationModel extends Model {
541 } 549 }
542 550
543 formatAbuse (this: UserNotificationModelForApi, abuse: UserNotificationIncludes.AbuseInclude) { 551 formatAbuse (this: UserNotificationModelForApi, abuse: UserNotificationIncludes.AbuseInclude) {
544 const commentAbuse = abuse.VideoCommentAbuse?.VideoComment ? { 552 const commentAbuse = abuse.VideoCommentAbuse?.VideoComment
545 threadId: abuse.VideoCommentAbuse.VideoComment.getThreadId(), 553 ? {
546 554 threadId: abuse.VideoCommentAbuse.VideoComment.getThreadId(),
547 video: { 555
548 id: abuse.VideoCommentAbuse.VideoComment.Video.id, 556 video: {
549 name: abuse.VideoCommentAbuse.VideoComment.Video.name, 557 id: abuse.VideoCommentAbuse.VideoComment.Video.id,
550 uuid: abuse.VideoCommentAbuse.VideoComment.Video.uuid 558 name: abuse.VideoCommentAbuse.VideoComment.Video.name,
559 uuid: abuse.VideoCommentAbuse.VideoComment.Video.uuid
560 }
551 } 561 }
552 } : undefined 562 : undefined
553 563
554 const videoAbuse = abuse.VideoAbuse?.Video ? this.formatVideo(abuse.VideoAbuse.Video) : undefined 564 const videoAbuse = abuse.VideoAbuse?.Video ? this.formatVideo(abuse.VideoAbuse.Video) : undefined
555 565