+ formatAbuse (this: UserNotificationModelForApi, abuse: UserNotificationIncludes.AbuseInclude) {
+ const commentAbuse = abuse.VideoCommentAbuse?.VideoComment ? {
+ threadId: abuse.VideoCommentAbuse.VideoComment.getThreadId(),
+
+ video: {
+ id: abuse.VideoCommentAbuse.VideoComment.Video.id,
+ name: abuse.VideoCommentAbuse.VideoComment.Video.name,
+ uuid: abuse.VideoCommentAbuse.VideoComment.Video.uuid
+ }
+ } : undefined
+
+ const videoAbuse = abuse.VideoAbuse?.Video ? this.formatVideo(abuse.VideoAbuse.Video) : undefined
+
+ const accountAbuse = (!commentAbuse && !videoAbuse) ? this.formatActor(abuse.FlaggedAccount) : undefined
+
+ return {
+ id: abuse.id,
+ video: videoAbuse,
+ comment: commentAbuse,
+ account: accountAbuse
+ }
+ }
+
+ formatActor (
+ this: UserNotificationModelForApi,
+ accountOrChannel: UserNotificationIncludes.AccountIncludeActor | UserNotificationIncludes.VideoChannelIncludeActor
+ ) {