1 import { AbuseMessageModel } from '@server/models/abuse/abuse-message'
2 import { getServerActor } from '@server/models/application/application'
3 import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
8 MUserNotifSettingAccount,
9 MUserWithNotificationSetting,
10 UserNotificationModelForApi
11 } from '@server/types/models/user'
12 import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist'
13 import { MVideoImportVideo } from '@server/types/models/video/video-import'
14 import { UserAbuse } from '@shared/models'
15 import { UserNotificationSettingValue, UserNotificationType, UserRight } from '../../shared/models/users'
16 import { VideoPrivacy, VideoState } from '../../shared/models/videos'
17 import { logger } from '../helpers/logger'
18 import { CONFIG } from '../initializers/config'
19 import { AccountBlocklistModel } from '../models/account/account-blocklist'
20 import { UserModel } from '../models/account/user'
21 import { UserNotificationModel } from '../models/account/user-notification'
22 import { MAbuseFull, MAbuseMessage, MAccountServer, MActorFollowFull } from '../types/models'
23 import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../types/models/video'
24 import { isBlockedByServerOrAccount } from './blocklist'
25 import { Emailer } from './emailer'
26 import { PeerTubeSocket } from './peertube-socket'
27 import { AccountModel } from '@server/models/account/account'
31 private static instance: Notifier
33 private constructor () {
36 notifyOnNewVideoIfNeeded (video: MVideoAccountLight): void {
37 // Only notify on public and published videos which are not blacklisted
38 if (video.privacy !== VideoPrivacy.PUBLIC || video.state !== VideoState.PUBLISHED || video.isBlacklisted()) return
40 this.notifySubscribersOfNewVideo(video)
41 .catch(err => logger.error('Cannot notify subscribers of new video %s.', video.url, { err }))
44 notifyOnVideoPublishedAfterTranscoding (video: MVideoFullLight): void {
45 // don't notify if didn't wait for transcoding or video is still blacklisted/waiting for scheduled update
46 if (!video.waitTranscoding || video.VideoBlacklist || video.ScheduleVideoUpdate) return
48 this.notifyOwnedVideoHasBeenPublished(video)
49 .catch(err => logger.error('Cannot notify owner that its video %s has been published after transcoding.', video.url, { err }))
52 notifyOnVideoPublishedAfterScheduledUpdate (video: MVideoFullLight): void {
53 // don't notify if video is still blacklisted or waiting for transcoding
54 if (video.VideoBlacklist || (video.waitTranscoding && video.state !== VideoState.PUBLISHED)) return
56 this.notifyOwnedVideoHasBeenPublished(video)
57 .catch(err => logger.error('Cannot notify owner that its video %s has been published after scheduled update.', video.url, { err }))
60 notifyOnVideoPublishedAfterRemovedFromAutoBlacklist (video: MVideoFullLight): void {
61 // don't notify if video is still waiting for transcoding or scheduled update
62 if (video.ScheduleVideoUpdate || (video.waitTranscoding && video.state !== VideoState.PUBLISHED)) return
64 this.notifyOwnedVideoHasBeenPublished(video)
66 logger.error('Cannot notify owner that its video %s has been published after removed from auto-blacklist.', video.url, { err })
70 notifyOnNewComment (comment: MCommentOwnerVideo): void {
71 this.notifyVideoOwnerOfNewComment(comment)
72 .catch(err => logger.error('Cannot notify video owner of new comment %s.', comment.url, { err }))
74 this.notifyOfCommentMention(comment)
75 .catch(err => logger.error('Cannot notify mentions of comment %s.', comment.url, { err }))
78 notifyOnNewAbuse (parameters: { abuse: UserAbuse, abuseInstance: MAbuseFull, reporter: string }): void {
79 this.notifyModeratorsOfNewAbuse(parameters)
80 .catch(err => logger.error('Cannot notify of new abuse %d.', parameters.abuseInstance.id, { err }))
83 notifyOnVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo): void {
84 this.notifyModeratorsOfVideoAutoBlacklist(videoBlacklist)
85 .catch(err => logger.error('Cannot notify of auto-blacklist of video %s.', videoBlacklist.Video.url, { err }))
88 notifyOnVideoBlacklist (videoBlacklist: MVideoBlacklistVideo): void {
89 this.notifyVideoOwnerOfBlacklist(videoBlacklist)
90 .catch(err => logger.error('Cannot notify video owner of new video blacklist of %s.', videoBlacklist.Video.url, { err }))
93 notifyOnVideoUnblacklist (video: MVideoFullLight): void {
94 this.notifyVideoOwnerOfUnblacklist(video)
95 .catch(err => logger.error('Cannot notify video owner of unblacklist of %s.', video.url, { err }))
98 notifyOnFinishedVideoImport (videoImport: MVideoImportVideo, success: boolean): void {
99 this.notifyOwnerVideoImportIsFinished(videoImport, success)
100 .catch(err => logger.error('Cannot notify owner that its video import %s is finished.', videoImport.getTargetIdentifier(), { err }))
103 notifyOnNewUserRegistration (user: MUserDefault): void {
104 this.notifyModeratorsOfNewUserRegistration(user)
105 .catch(err => logger.error('Cannot notify moderators of new user registration (%s).', user.username, { err }))
108 notifyOfNewUserFollow (actorFollow: MActorFollowFull): void {
109 this.notifyUserOfNewActorFollow(actorFollow)
112 'Cannot notify owner of channel %s of a new follow by %s.',
113 actorFollow.ActorFollowing.VideoChannel.getDisplayName(),
114 actorFollow.ActorFollower.Account.getDisplayName(),
120 notifyOfNewInstanceFollow (actorFollow: MActorFollowFull): void {
121 this.notifyAdminsOfNewInstanceFollow(actorFollow)
123 logger.error('Cannot notify administrators of new follower %s.', actorFollow.ActorFollower.url, { err })
127 notifyOfAutoInstanceFollowing (actorFollow: MActorFollowFull): void {
128 this.notifyAdminsOfAutoInstanceFollowing(actorFollow)
130 logger.error('Cannot notify administrators of auto instance following %s.', actorFollow.ActorFollowing.url, { err })
134 notifyOnAbuseStateChange (abuse: MAbuseFull): void {
135 this.notifyReporterOfAbuseStateChange(abuse)
137 logger.error('Cannot notify reporter of abuse %d state change.', abuse.id, { err })
141 notifyOnAbuseMessage (abuse: MAbuseFull, message: MAbuseMessage): void {
142 this.notifyOfNewAbuseMessage(abuse, message)
144 logger.error('Cannot notify on new abuse %d message.', abuse.id, { err })
148 private async notifySubscribersOfNewVideo (video: MVideoAccountLight) {
149 // List all followers that are users
150 const users = await UserModel.listUserSubscribersOf(video.VideoChannel.actorId)
152 logger.info('Notifying %d users of new video %s.', users.length, video.url)
154 function settingGetter (user: MUserWithNotificationSetting) {
155 return user.NotificationSetting.newVideoFromSubscription
158 async function notificationCreator (user: MUserWithNotificationSetting) {
159 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
160 type: UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION,
164 notification.Video = video
169 function emailSender (emails: string[]) {
170 return Emailer.Instance.addNewVideoFromSubscriberNotification(emails, video)
173 return this.notify({ users, settingGetter, notificationCreator, emailSender })
176 private async notifyVideoOwnerOfNewComment (comment: MCommentOwnerVideo) {
177 if (comment.Video.isOwned() === false) return
179 const user = await UserModel.loadByVideoId(comment.videoId)
181 // Not our user or user comments its own video
182 if (!user || comment.Account.userId === user.id) return
184 if (await this.isBlockedByServerOrUser(comment.Account, user)) return
186 logger.info('Notifying user %s of new comment %s.', user.username, comment.url)
188 function settingGetter (user: MUserWithNotificationSetting) {
189 return user.NotificationSetting.newCommentOnMyVideo
192 async function notificationCreator (user: MUserWithNotificationSetting) {
193 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
194 type: UserNotificationType.NEW_COMMENT_ON_MY_VIDEO,
196 commentId: comment.id
198 notification.Comment = comment
203 function emailSender (emails: string[]) {
204 return Emailer.Instance.addNewCommentOnMyVideoNotification(emails, comment)
207 return this.notify({ users: [ user ], settingGetter, notificationCreator, emailSender })
210 private async notifyOfCommentMention (comment: MCommentOwnerVideo) {
211 const extractedUsernames = comment.extractMentions()
213 'Extracted %d username from comment %s.', extractedUsernames.length, comment.url,
214 { usernames: extractedUsernames, text: comment.text }
217 let users = await UserModel.listByUsernames(extractedUsernames)
219 if (comment.Video.isOwned()) {
220 const userException = await UserModel.loadByVideoId(comment.videoId)
221 users = users.filter(u => u.id !== userException.id)
224 // Don't notify if I mentioned myself
225 users = users.filter(u => u.Account.id !== comment.accountId)
227 if (users.length === 0) return
229 const serverAccountId = (await getServerActor()).Account.id
230 const sourceAccounts = users.map(u => u.Account.id).concat([ serverAccountId ])
232 const accountMutedHash = await AccountBlocklistModel.isAccountMutedByMulti(sourceAccounts, comment.accountId)
233 const instanceMutedHash = await ServerBlocklistModel.isServerMutedByMulti(sourceAccounts, comment.Account.Actor.serverId)
235 logger.info('Notifying %d users of new comment %s.', users.length, comment.url)
237 function settingGetter (user: MUserNotifSettingAccount) {
238 const accountId = user.Account.id
240 accountMutedHash[accountId] === true || instanceMutedHash[accountId] === true ||
241 accountMutedHash[serverAccountId] === true || instanceMutedHash[serverAccountId] === true
243 return UserNotificationSettingValue.NONE
246 return user.NotificationSetting.commentMention
249 async function notificationCreator (user: MUserNotifSettingAccount) {
250 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
251 type: UserNotificationType.COMMENT_MENTION,
253 commentId: comment.id
255 notification.Comment = comment
260 function emailSender (emails: string[]) {
261 return Emailer.Instance.addNewCommentMentionNotification(emails, comment)
264 return this.notify({ users, settingGetter, notificationCreator, emailSender })
267 private async notifyUserOfNewActorFollow (actorFollow: MActorFollowFull) {
268 if (actorFollow.ActorFollowing.isOwned() === false) return
270 // Account follows one of our account?
271 let followType: 'account' | 'channel' = 'channel'
272 let user = await UserModel.loadByChannelActorId(actorFollow.ActorFollowing.id)
274 // Account follows one of our channel?
276 user = await UserModel.loadByAccountActorId(actorFollow.ActorFollowing.id)
277 followType = 'account'
282 const followerAccount = actorFollow.ActorFollower.Account
283 const followerAccountWithActor = Object.assign(followerAccount, { Actor: actorFollow.ActorFollower })
285 if (await this.isBlockedByServerOrUser(followerAccountWithActor, user)) return
287 logger.info('Notifying user %s of new follower: %s.', user.username, followerAccount.getDisplayName())
289 function settingGetter (user: MUserWithNotificationSetting) {
290 return user.NotificationSetting.newFollow
293 async function notificationCreator (user: MUserWithNotificationSetting) {
294 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
295 type: UserNotificationType.NEW_FOLLOW,
297 actorFollowId: actorFollow.id
299 notification.ActorFollow = actorFollow
304 function emailSender (emails: string[]) {
305 return Emailer.Instance.addNewFollowNotification(emails, actorFollow, followType)
308 return this.notify({ users: [ user ], settingGetter, notificationCreator, emailSender })
311 private async notifyAdminsOfNewInstanceFollow (actorFollow: MActorFollowFull) {
312 const admins = await UserModel.listWithRight(UserRight.MANAGE_SERVER_FOLLOW)
314 const follower = Object.assign(actorFollow.ActorFollower.Account, { Actor: actorFollow.ActorFollower })
315 if (await this.isBlockedByServerOrUser(follower)) return
317 logger.info('Notifying %d administrators of new instance follower: %s.', admins.length, actorFollow.ActorFollower.url)
319 function settingGetter (user: MUserWithNotificationSetting) {
320 return user.NotificationSetting.newInstanceFollower
323 async function notificationCreator (user: MUserWithNotificationSetting) {
324 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
325 type: UserNotificationType.NEW_INSTANCE_FOLLOWER,
327 actorFollowId: actorFollow.id
329 notification.ActorFollow = actorFollow
334 function emailSender (emails: string[]) {
335 return Emailer.Instance.addNewInstanceFollowerNotification(emails, actorFollow)
338 return this.notify({ users: admins, settingGetter, notificationCreator, emailSender })
341 private async notifyAdminsOfAutoInstanceFollowing (actorFollow: MActorFollowFull) {
342 const admins = await UserModel.listWithRight(UserRight.MANAGE_SERVER_FOLLOW)
344 logger.info('Notifying %d administrators of auto instance following: %s.', admins.length, actorFollow.ActorFollowing.url)
346 function settingGetter (user: MUserWithNotificationSetting) {
347 return user.NotificationSetting.autoInstanceFollowing
350 async function notificationCreator (user: MUserWithNotificationSetting) {
351 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
352 type: UserNotificationType.AUTO_INSTANCE_FOLLOWING,
354 actorFollowId: actorFollow.id
356 notification.ActorFollow = actorFollow
361 function emailSender (emails: string[]) {
362 return Emailer.Instance.addAutoInstanceFollowingNotification(emails, actorFollow)
365 return this.notify({ users: admins, settingGetter, notificationCreator, emailSender })
368 private async notifyModeratorsOfNewAbuse (parameters: {
370 abuseInstance: MAbuseFull
373 const { abuse, abuseInstance } = parameters
375 const moderators = await UserModel.listWithRight(UserRight.MANAGE_ABUSES)
376 if (moderators.length === 0) return
378 const url = this.getAbuseUrl(abuseInstance)
380 logger.info('Notifying %s user/moderators of new abuse %s.', moderators.length, url)
382 function settingGetter (user: MUserWithNotificationSetting) {
383 return user.NotificationSetting.abuseAsModerator
386 async function notificationCreator (user: MUserWithNotificationSetting) {
387 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
388 type: UserNotificationType.NEW_ABUSE_FOR_MODERATORS,
392 notification.Abuse = abuseInstance
397 function emailSender (emails: string[]) {
398 return Emailer.Instance.addAbuseModeratorsNotification(emails, parameters)
401 return this.notify({ users: moderators, settingGetter, notificationCreator, emailSender })
404 private async notifyReporterOfAbuseStateChange (abuse: MAbuseFull) {
405 // Only notify our users
406 if (abuse.ReporterAccount.isOwned() !== true) return
408 const url = this.getAbuseUrl(abuse)
410 logger.info('Notifying reporter of abuse % of state change.', url)
412 const reporter = await UserModel.loadByAccountActorId(abuse.ReporterAccount.actorId)
414 function settingGetter (user: MUserWithNotificationSetting) {
415 return user.NotificationSetting.abuseStateChange
418 async function notificationCreator (user: MUserWithNotificationSetting) {
419 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
420 type: UserNotificationType.ABUSE_STATE_CHANGE,
424 notification.Abuse = abuse
429 function emailSender (emails: string[]) {
430 return Emailer.Instance.addAbuseStateChangeNotification(emails, abuse)
433 return this.notify({ users: [ reporter ], settingGetter, notificationCreator, emailSender })
436 private async notifyOfNewAbuseMessage (abuse: MAbuseFull, message: MAbuseMessage) {
437 const url = this.getAbuseUrl(abuse)
438 logger.info('Notifying reporter and moderators of new abuse message on %s.', url)
440 const accountMessage = await AccountModel.load(message.accountId)
442 function settingGetter (user: MUserWithNotificationSetting) {
443 return user.NotificationSetting.abuseNewMessage
446 async function notificationCreator (user: MUserWithNotificationSetting) {
447 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
448 type: UserNotificationType.ABUSE_NEW_MESSAGE,
452 notification.Abuse = abuse
457 function emailSenderReporter (emails: string[]) {
458 return Emailer.Instance.addAbuseNewMessageNotification(emails, { target: 'reporter', abuse, message, accountMessage })
461 function emailSenderModerators (emails: string[]) {
462 return Emailer.Instance.addAbuseNewMessageNotification(emails, { target: 'moderator', abuse, message, accountMessage })
465 async function buildReporterOptions () {
466 // Only notify our users
467 if (abuse.ReporterAccount.isOwned() !== true) return
469 const reporter = await UserModel.loadByAccountActorId(abuse.ReporterAccount.actorId)
470 // Don't notify my own message
471 if (reporter.Account.id === message.accountId) return
473 return { users: [ reporter ], settingGetter, notificationCreator, emailSender: emailSenderReporter }
476 async function buildModeratorsOptions () {
477 let moderators = await UserModel.listWithRight(UserRight.MANAGE_ABUSES)
478 // Don't notify my own message
479 moderators = moderators.filter(m => m.Account.id !== message.accountId)
481 if (moderators.length === 0) return
483 return { users: moderators, settingGetter, notificationCreator, emailSender: emailSenderModerators }
486 const [ reporterOptions, moderatorsOptions ] = await Promise.all([
487 buildReporterOptions(),
488 buildModeratorsOptions()
492 this.notify(reporterOptions),
493 this.notify(moderatorsOptions)
497 private async notifyModeratorsOfVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo) {
498 const moderators = await UserModel.listWithRight(UserRight.MANAGE_VIDEO_BLACKLIST)
499 if (moderators.length === 0) return
501 logger.info('Notifying %s moderators of video auto-blacklist %s.', moderators.length, videoBlacklist.Video.url)
503 function settingGetter (user: MUserWithNotificationSetting) {
504 return user.NotificationSetting.videoAutoBlacklistAsModerator
507 async function notificationCreator (user: MUserWithNotificationSetting) {
508 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
509 type: UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS,
511 videoBlacklistId: videoBlacklist.id
513 notification.VideoBlacklist = videoBlacklist
518 function emailSender (emails: string[]) {
519 return Emailer.Instance.addVideoAutoBlacklistModeratorsNotification(emails, videoBlacklist)
522 return this.notify({ users: moderators, settingGetter, notificationCreator, emailSender })
525 private async notifyVideoOwnerOfBlacklist (videoBlacklist: MVideoBlacklistVideo) {
526 const user = await UserModel.loadByVideoId(videoBlacklist.videoId)
529 logger.info('Notifying user %s that its video %s has been blacklisted.', user.username, videoBlacklist.Video.url)
531 function settingGetter (user: MUserWithNotificationSetting) {
532 return user.NotificationSetting.blacklistOnMyVideo
535 async function notificationCreator (user: MUserWithNotificationSetting) {
536 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
537 type: UserNotificationType.BLACKLIST_ON_MY_VIDEO,
539 videoBlacklistId: videoBlacklist.id
541 notification.VideoBlacklist = videoBlacklist
546 function emailSender (emails: string[]) {
547 return Emailer.Instance.addVideoBlacklistNotification(emails, videoBlacklist)
550 return this.notify({ users: [ user ], settingGetter, notificationCreator, emailSender })
553 private async notifyVideoOwnerOfUnblacklist (video: MVideoFullLight) {
554 const user = await UserModel.loadByVideoId(video.id)
557 logger.info('Notifying user %s that its video %s has been unblacklisted.', user.username, video.url)
559 function settingGetter (user: MUserWithNotificationSetting) {
560 return user.NotificationSetting.blacklistOnMyVideo
563 async function notificationCreator (user: MUserWithNotificationSetting) {
564 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
565 type: UserNotificationType.UNBLACKLIST_ON_MY_VIDEO,
569 notification.Video = video
574 function emailSender (emails: string[]) {
575 return Emailer.Instance.addVideoUnblacklistNotification(emails, video)
578 return this.notify({ users: [ user ], settingGetter, notificationCreator, emailSender })
581 private async notifyOwnedVideoHasBeenPublished (video: MVideoFullLight) {
582 const user = await UserModel.loadByVideoId(video.id)
585 logger.info('Notifying user %s of the publication of its video %s.', user.username, video.url)
587 function settingGetter (user: MUserWithNotificationSetting) {
588 return user.NotificationSetting.myVideoPublished
591 async function notificationCreator (user: MUserWithNotificationSetting) {
592 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
593 type: UserNotificationType.MY_VIDEO_PUBLISHED,
597 notification.Video = video
602 function emailSender (emails: string[]) {
603 return Emailer.Instance.myVideoPublishedNotification(emails, video)
606 return this.notify({ users: [ user ], settingGetter, notificationCreator, emailSender })
609 private async notifyOwnerVideoImportIsFinished (videoImport: MVideoImportVideo, success: boolean) {
610 const user = await UserModel.loadByVideoImportId(videoImport.id)
613 logger.info('Notifying user %s its video import %s is finished.', user.username, videoImport.getTargetIdentifier())
615 function settingGetter (user: MUserWithNotificationSetting) {
616 return user.NotificationSetting.myVideoImportFinished
619 async function notificationCreator (user: MUserWithNotificationSetting) {
620 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
621 type: success ? UserNotificationType.MY_VIDEO_IMPORT_SUCCESS : UserNotificationType.MY_VIDEO_IMPORT_ERROR,
623 videoImportId: videoImport.id
625 notification.VideoImport = videoImport
630 function emailSender (emails: string[]) {
632 ? Emailer.Instance.myVideoImportSuccessNotification(emails, videoImport)
633 : Emailer.Instance.myVideoImportErrorNotification(emails, videoImport)
636 return this.notify({ users: [ user ], settingGetter, notificationCreator, emailSender })
639 private async notifyModeratorsOfNewUserRegistration (registeredUser: MUserDefault) {
640 const moderators = await UserModel.listWithRight(UserRight.MANAGE_USERS)
641 if (moderators.length === 0) return
644 'Notifying %s moderators of new user registration of %s.',
645 moderators.length, registeredUser.username
648 function settingGetter (user: MUserWithNotificationSetting) {
649 return user.NotificationSetting.newUserRegistration
652 async function notificationCreator (user: MUserWithNotificationSetting) {
653 const notification = await UserNotificationModel.create<UserNotificationModelForApi>({
654 type: UserNotificationType.NEW_USER_REGISTRATION,
656 accountId: registeredUser.Account.id
658 notification.Account = registeredUser.Account
663 function emailSender (emails: string[]) {
664 return Emailer.Instance.addNewUserRegistrationNotification(emails, registeredUser)
667 return this.notify({ users: moderators, settingGetter, notificationCreator, emailSender })
670 private async notify<T extends MUserWithNotificationSetting> (options: {
672 notificationCreator: (user: T) => Promise<UserNotificationModelForApi>
673 emailSender: (emails: string[]) => void
674 settingGetter: (user: T) => UserNotificationSettingValue
676 const emails: string[] = []
678 for (const user of options.users) {
679 if (this.isWebNotificationEnabled(options.settingGetter(user))) {
680 const notification = await options.notificationCreator(user)
682 PeerTubeSocket.Instance.sendNotification(user.id, notification)
685 if (this.isEmailEnabled(user, options.settingGetter(user))) {
686 emails.push(user.email)
690 if (emails.length !== 0) {
691 options.emailSender(emails)
695 private isEmailEnabled (user: MUser, value: UserNotificationSettingValue) {
696 if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION === true && user.emailVerified === false) return false
698 return value & UserNotificationSettingValue.EMAIL
701 private isWebNotificationEnabled (value: UserNotificationSettingValue) {
702 return value & UserNotificationSettingValue.WEB
705 private isBlockedByServerOrUser (targetAccount: MAccountServer, user?: MUserAccount) {
706 return isBlockedByServerOrAccount(targetAccount, user?.Account)
709 private getAbuseUrl (abuse: MAbuseFull) {
710 return abuse.VideoAbuse?.Video?.url ||
711 abuse.VideoCommentAbuse?.VideoComment?.url ||
712 abuse.FlaggedAccount.Actor.url
715 static get Instance () {
716 return this.instance || (this.instance = new this())
720 // ---------------------------------------------------------------------------