1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import { expect } from 'chai'
4 import { inspect } from 'util'
5 import { AbuseState, PluginType } from '@shared/models'
6 import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
7 import { UserNotification, UserNotificationSetting, UserNotificationSettingValue, UserNotificationType } from '../../models/users'
8 import { MockSmtpServer } from '../mock-servers/mock-email'
9 import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'
10 import { doubleFollow } from '../server/follows'
11 import { flushAndRunMultipleServers, ServerInfo } from '../server/servers'
12 import { setAccessTokensToServers, userLogin } from './login'
13 import { createUser, getMyUserInformation } from './users'
15 function updateMyNotificationSettings (
18 settings: UserNotificationSetting,
19 statusCodeExpected = HttpStatusCode.NO_CONTENT_204
21 const path = '/api/v1/users/me/notification-settings'
23 return makePutBodyRequest({
32 async function getUserNotifications (
39 statusCodeExpected = HttpStatusCode.OK_200
41 const path = '/api/v1/users/me/notifications'
43 return makeGetRequest({
57 function markAsReadNotifications (url: string, token: string, ids: number[], statusCodeExpected = HttpStatusCode.NO_CONTENT_204) {
58 const path = '/api/v1/users/me/notifications/read'
60 return makePostBodyRequest({
69 function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = HttpStatusCode.NO_CONTENT_204) {
70 const path = '/api/v1/users/me/notifications/read-all'
72 return makePostBodyRequest({
80 async function getLastNotification (serverUrl: string, accessToken: string) {
81 const res = await getUserNotifications(serverUrl, accessToken, 0, 1, undefined, '-createdAt')
83 if (res.body.total === 0) return undefined
85 return res.body.data[0] as UserNotification
88 type CheckerBaseParams = {
91 socketNotifications: UserNotification[]
93 check?: { web: boolean, mail: boolean }
96 type CheckerType = 'presence' | 'absence'
98 async function checkNotification (
99 base: CheckerBaseParams,
100 notificationChecker: (notification: UserNotification, type: CheckerType) => void,
101 emailNotificationFinder: (email: object) => boolean,
102 checkType: CheckerType
104 const check = base.check || { web: true, mail: true }
107 const notification = await getLastNotification(base.server.url, base.token)
109 if (notification || checkType !== 'absence') {
110 notificationChecker(notification, checkType)
113 const socketNotification = base.socketNotifications.find(n => {
115 notificationChecker(n, 'presence')
122 if (checkType === 'presence') {
123 const obj = inspect(base.socketNotifications, { depth: 5 })
124 expect(socketNotification, 'The socket notification is absent when it should be present. ' + obj).to.not.be.undefined
126 const obj = inspect(socketNotification, { depth: 5 })
127 expect(socketNotification, 'The socket notification is present when it should not be present. ' + obj).to.be.undefined
133 const email = base.emails
136 .find(e => emailNotificationFinder(e))
138 if (checkType === 'presence') {
139 const emails = base.emails.map(e => e.text)
140 expect(email, 'The email is absent when is should be present. ' + inspect(emails)).to.not.be.undefined
142 expect(email, 'The email is present when is should not be present. ' + inspect(email)).to.be.undefined
147 function checkVideo (video: any, videoName?: string, videoUUID?: string) {
149 expect(video.name).to.be.a('string')
150 expect(video.name).to.not.be.empty
151 expect(video.name).to.equal(videoName)
155 expect(video.uuid).to.be.a('string')
156 expect(video.uuid).to.not.be.empty
157 expect(video.uuid).to.equal(videoUUID)
160 expect(video.id).to.be.a('number')
163 function checkActor (actor: any) {
164 expect(actor.displayName).to.be.a('string')
165 expect(actor.displayName).to.not.be.empty
166 expect(actor.host).to.not.be.undefined
169 function checkComment (comment: any, commentId: number, threadId: number) {
170 expect(comment.id).to.equal(commentId)
171 expect(comment.threadId).to.equal(threadId)
174 async function checkNewVideoFromSubscription (base: CheckerBaseParams, videoName: string, videoUUID: string, type: CheckerType) {
175 const notificationType = UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION
177 function notificationChecker (notification: UserNotification, type: CheckerType) {
178 if (type === 'presence') {
179 expect(notification).to.not.be.undefined
180 expect(notification.type).to.equal(notificationType)
182 checkVideo(notification.video, videoName, videoUUID)
183 checkActor(notification.video.channel)
185 expect(notification).to.satisfy((n: UserNotification) => {
186 return n === undefined || n.type !== UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION || n.video.name !== videoName
191 function emailNotificationFinder (email: object) {
192 const text = email['text']
193 return text.indexOf(videoUUID) !== -1 && text.indexOf('Your subscription') !== -1
196 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
199 async function checkVideoIsPublished (base: CheckerBaseParams, videoName: string, videoUUID: string, type: CheckerType) {
200 const notificationType = UserNotificationType.MY_VIDEO_PUBLISHED
202 function notificationChecker (notification: UserNotification, type: CheckerType) {
203 if (type === 'presence') {
204 expect(notification).to.not.be.undefined
205 expect(notification.type).to.equal(notificationType)
207 checkVideo(notification.video, videoName, videoUUID)
208 checkActor(notification.video.channel)
210 expect(notification.video).to.satisfy(v => v === undefined || v.name !== videoName)
214 function emailNotificationFinder (email: object) {
215 const text: string = email['text']
216 return text.includes(videoUUID) && text.includes('Your video')
219 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
222 async function checkMyVideoImportIsFinished (
223 base: CheckerBaseParams,
230 const notificationType = success ? UserNotificationType.MY_VIDEO_IMPORT_SUCCESS : UserNotificationType.MY_VIDEO_IMPORT_ERROR
232 function notificationChecker (notification: UserNotification, type: CheckerType) {
233 if (type === 'presence') {
234 expect(notification).to.not.be.undefined
235 expect(notification.type).to.equal(notificationType)
237 expect(notification.videoImport.targetUrl).to.equal(url)
239 if (success) checkVideo(notification.videoImport.video, videoName, videoUUID)
241 expect(notification.videoImport).to.satisfy(i => i === undefined || i.targetUrl !== url)
245 function emailNotificationFinder (email: object) {
246 const text: string = email['text']
247 const toFind = success ? ' finished' : ' error'
249 return text.includes(url) && text.includes(toFind)
252 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
255 async function checkUserRegistered (base: CheckerBaseParams, username: string, type: CheckerType) {
256 const notificationType = UserNotificationType.NEW_USER_REGISTRATION
258 function notificationChecker (notification: UserNotification, type: CheckerType) {
259 if (type === 'presence') {
260 expect(notification).to.not.be.undefined
261 expect(notification.type).to.equal(notificationType)
263 checkActor(notification.account)
264 expect(notification.account.name).to.equal(username)
266 expect(notification).to.satisfy(n => n.type !== notificationType || n.account.name !== username)
270 function emailNotificationFinder (email: object) {
271 const text: string = email['text']
273 return text.includes(' registered.') && text.includes(username)
276 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
279 async function checkNewActorFollow (
280 base: CheckerBaseParams,
281 followType: 'channel' | 'account',
282 followerName: string,
283 followerDisplayName: string,
284 followingDisplayName: string,
287 const notificationType = UserNotificationType.NEW_FOLLOW
289 function notificationChecker (notification: UserNotification, type: CheckerType) {
290 if (type === 'presence') {
291 expect(notification).to.not.be.undefined
292 expect(notification.type).to.equal(notificationType)
294 checkActor(notification.actorFollow.follower)
295 expect(notification.actorFollow.follower.displayName).to.equal(followerDisplayName)
296 expect(notification.actorFollow.follower.name).to.equal(followerName)
297 expect(notification.actorFollow.follower.host).to.not.be.undefined
299 const following = notification.actorFollow.following
300 expect(following.displayName).to.equal(followingDisplayName)
301 expect(following.type).to.equal(followType)
303 expect(notification).to.satisfy(n => {
304 return n.type !== notificationType ||
305 (n.actorFollow.follower.name !== followerName && n.actorFollow.following !== followingDisplayName)
310 function emailNotificationFinder (email: object) {
311 const text: string = email['text']
313 return text.includes(followType) && text.includes(followingDisplayName) && text.includes(followerDisplayName)
316 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
319 async function checkNewInstanceFollower (base: CheckerBaseParams, followerHost: string, type: CheckerType) {
320 const notificationType = UserNotificationType.NEW_INSTANCE_FOLLOWER
322 function notificationChecker (notification: UserNotification, type: CheckerType) {
323 if (type === 'presence') {
324 expect(notification).to.not.be.undefined
325 expect(notification.type).to.equal(notificationType)
327 checkActor(notification.actorFollow.follower)
328 expect(notification.actorFollow.follower.name).to.equal('peertube')
329 expect(notification.actorFollow.follower.host).to.equal(followerHost)
331 expect(notification.actorFollow.following.name).to.equal('peertube')
333 expect(notification).to.satisfy(n => {
334 return n.type !== notificationType || n.actorFollow.follower.host !== followerHost
339 function emailNotificationFinder (email: object) {
340 const text: string = email['text']
342 return text.includes('instance has a new follower') && text.includes(followerHost)
345 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
348 async function checkAutoInstanceFollowing (base: CheckerBaseParams, followerHost: string, followingHost: string, type: CheckerType) {
349 const notificationType = UserNotificationType.AUTO_INSTANCE_FOLLOWING
351 function notificationChecker (notification: UserNotification, type: CheckerType) {
352 if (type === 'presence') {
353 expect(notification).to.not.be.undefined
354 expect(notification.type).to.equal(notificationType)
356 const following = notification.actorFollow.following
357 checkActor(following)
358 expect(following.name).to.equal('peertube')
359 expect(following.host).to.equal(followingHost)
361 expect(notification.actorFollow.follower.name).to.equal('peertube')
362 expect(notification.actorFollow.follower.host).to.equal(followerHost)
364 expect(notification).to.satisfy(n => {
365 return n.type !== notificationType || n.actorFollow.following.host !== followingHost
370 function emailNotificationFinder (email: object) {
371 const text: string = email['text']
373 return text.includes(' automatically followed a new instance') && text.includes(followingHost)
376 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
379 async function checkCommentMention (
380 base: CheckerBaseParams,
384 byAccountDisplayName: string,
387 const notificationType = UserNotificationType.COMMENT_MENTION
389 function notificationChecker (notification: UserNotification, type: CheckerType) {
390 if (type === 'presence') {
391 expect(notification).to.not.be.undefined
392 expect(notification.type).to.equal(notificationType)
394 checkComment(notification.comment, commentId, threadId)
395 checkActor(notification.comment.account)
396 expect(notification.comment.account.displayName).to.equal(byAccountDisplayName)
398 checkVideo(notification.comment.video, undefined, uuid)
400 expect(notification).to.satisfy(n => n.type !== notificationType || n.comment.id !== commentId)
404 function emailNotificationFinder (email: object) {
405 const text: string = email['text']
407 return text.includes(' mentioned ') && text.includes(uuid) && text.includes(byAccountDisplayName)
410 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
413 let lastEmailCount = 0
415 async function checkNewCommentOnMyVideo (base: CheckerBaseParams, uuid: string, commentId: number, threadId: number, type: CheckerType) {
416 const notificationType = UserNotificationType.NEW_COMMENT_ON_MY_VIDEO
418 function notificationChecker (notification: UserNotification, type: CheckerType) {
419 if (type === 'presence') {
420 expect(notification).to.not.be.undefined
421 expect(notification.type).to.equal(notificationType)
423 checkComment(notification.comment, commentId, threadId)
424 checkActor(notification.comment.account)
425 checkVideo(notification.comment.video, undefined, uuid)
427 expect(notification).to.satisfy((n: UserNotification) => {
428 return n === undefined || n.comment === undefined || n.comment.id !== commentId
433 const commentUrl = `http://localhost:${base.server.port}/w/${uuid};threadId=${threadId}`
435 function emailNotificationFinder (email: object) {
436 return email['text'].indexOf(commentUrl) !== -1
439 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
441 if (type === 'presence') {
442 // We cannot detect email duplicates, so check we received another email
443 expect(base.emails).to.have.length.above(lastEmailCount)
444 lastEmailCount = base.emails.length
448 async function checkNewVideoAbuseForModerators (base: CheckerBaseParams, videoUUID: string, videoName: string, type: CheckerType) {
449 const notificationType = UserNotificationType.NEW_ABUSE_FOR_MODERATORS
451 function notificationChecker (notification: UserNotification, type: CheckerType) {
452 if (type === 'presence') {
453 expect(notification).to.not.be.undefined
454 expect(notification.type).to.equal(notificationType)
456 expect(notification.abuse.id).to.be.a('number')
457 checkVideo(notification.abuse.video, videoName, videoUUID)
459 expect(notification).to.satisfy((n: UserNotification) => {
460 return n === undefined || n.abuse === undefined || n.abuse.video.uuid !== videoUUID
465 function emailNotificationFinder (email: object) {
466 const text = email['text']
467 return text.indexOf(videoUUID) !== -1 && text.indexOf('abuse') !== -1
470 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
473 async function checkNewAbuseMessage (base: CheckerBaseParams, abuseId: number, message: string, toEmail: string, type: CheckerType) {
474 const notificationType = UserNotificationType.ABUSE_NEW_MESSAGE
476 function notificationChecker (notification: UserNotification, type: CheckerType) {
477 if (type === 'presence') {
478 expect(notification).to.not.be.undefined
479 expect(notification.type).to.equal(notificationType)
481 expect(notification.abuse.id).to.equal(abuseId)
483 expect(notification).to.satisfy((n: UserNotification) => {
484 return n === undefined || n.type !== notificationType || n.abuse === undefined || n.abuse.id !== abuseId
489 function emailNotificationFinder (email: object) {
490 const text = email['text']
491 const to = email['to'].filter(t => t.address === toEmail)
493 return text.indexOf(message) !== -1 && to.length !== 0
496 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
499 async function checkAbuseStateChange (base: CheckerBaseParams, abuseId: number, state: AbuseState, type: CheckerType) {
500 const notificationType = UserNotificationType.ABUSE_STATE_CHANGE
502 function notificationChecker (notification: UserNotification, type: CheckerType) {
503 if (type === 'presence') {
504 expect(notification).to.not.be.undefined
505 expect(notification.type).to.equal(notificationType)
507 expect(notification.abuse.id).to.equal(abuseId)
508 expect(notification.abuse.state).to.equal(state)
510 expect(notification).to.satisfy((n: UserNotification) => {
511 return n === undefined || n.abuse === undefined || n.abuse.id !== abuseId
516 function emailNotificationFinder (email: object) {
517 const text = email['text']
519 const contains = state === AbuseState.ACCEPTED
523 return text.indexOf(contains) !== -1
526 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
529 async function checkNewCommentAbuseForModerators (base: CheckerBaseParams, videoUUID: string, videoName: string, type: CheckerType) {
530 const notificationType = UserNotificationType.NEW_ABUSE_FOR_MODERATORS
532 function notificationChecker (notification: UserNotification, type: CheckerType) {
533 if (type === 'presence') {
534 expect(notification).to.not.be.undefined
535 expect(notification.type).to.equal(notificationType)
537 expect(notification.abuse.id).to.be.a('number')
538 checkVideo(notification.abuse.comment.video, videoName, videoUUID)
540 expect(notification).to.satisfy((n: UserNotification) => {
541 return n === undefined || n.abuse === undefined || n.abuse.comment.video.uuid !== videoUUID
546 function emailNotificationFinder (email: object) {
547 const text = email['text']
548 return text.indexOf(videoUUID) !== -1 && text.indexOf('abuse') !== -1
551 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
554 async function checkNewAccountAbuseForModerators (base: CheckerBaseParams, displayName: string, type: CheckerType) {
555 const notificationType = UserNotificationType.NEW_ABUSE_FOR_MODERATORS
557 function notificationChecker (notification: UserNotification, type: CheckerType) {
558 if (type === 'presence') {
559 expect(notification).to.not.be.undefined
560 expect(notification.type).to.equal(notificationType)
562 expect(notification.abuse.id).to.be.a('number')
563 expect(notification.abuse.account.displayName).to.equal(displayName)
565 expect(notification).to.satisfy((n: UserNotification) => {
566 return n === undefined || n.abuse === undefined || n.abuse.account.displayName !== displayName
571 function emailNotificationFinder (email: object) {
572 const text = email['text']
573 return text.indexOf(displayName) !== -1 && text.indexOf('abuse') !== -1
576 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
579 async function checkVideoAutoBlacklistForModerators (base: CheckerBaseParams, videoUUID: string, videoName: string, type: CheckerType) {
580 const notificationType = UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS
582 function notificationChecker (notification: UserNotification, type: CheckerType) {
583 if (type === 'presence') {
584 expect(notification).to.not.be.undefined
585 expect(notification.type).to.equal(notificationType)
587 expect(notification.videoBlacklist.video.id).to.be.a('number')
588 checkVideo(notification.videoBlacklist.video, videoName, videoUUID)
590 expect(notification).to.satisfy((n: UserNotification) => {
591 return n === undefined || n.video === undefined || n.video.uuid !== videoUUID
596 function emailNotificationFinder (email: object) {
597 const text = email['text']
598 return text.indexOf(videoUUID) !== -1 && email['text'].indexOf('video-auto-blacklist/list') !== -1
601 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
604 async function checkNewBlacklistOnMyVideo (
605 base: CheckerBaseParams,
608 blacklistType: 'blacklist' | 'unblacklist'
610 const notificationType = blacklistType === 'blacklist'
611 ? UserNotificationType.BLACKLIST_ON_MY_VIDEO
612 : UserNotificationType.UNBLACKLIST_ON_MY_VIDEO
614 function notificationChecker (notification: UserNotification) {
615 expect(notification).to.not.be.undefined
616 expect(notification.type).to.equal(notificationType)
618 const video = blacklistType === 'blacklist' ? notification.videoBlacklist.video : notification.video
620 checkVideo(video, videoName, videoUUID)
623 function emailNotificationFinder (email: object) {
624 const text = email['text']
625 return text.indexOf(videoUUID) !== -1 && text.indexOf(' ' + blacklistType) !== -1
628 await checkNotification(base, notificationChecker, emailNotificationFinder, 'presence')
631 async function checkNewPeerTubeVersion (base: CheckerBaseParams, latestVersion: string, type: CheckerType) {
632 const notificationType = UserNotificationType.NEW_PEERTUBE_VERSION
634 function notificationChecker (notification: UserNotification, type: CheckerType) {
635 if (type === 'presence') {
636 expect(notification).to.not.be.undefined
637 expect(notification.type).to.equal(notificationType)
639 expect(notification.peertube).to.exist
640 expect(notification.peertube.latestVersion).to.equal(latestVersion)
642 expect(notification).to.satisfy((n: UserNotification) => {
643 return n === undefined || n.peertube === undefined || n.peertube.latestVersion !== latestVersion
648 function emailNotificationFinder (email: object) {
649 const text = email['text']
651 return text.includes(latestVersion)
654 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
657 async function checkNewPluginVersion (base: CheckerBaseParams, pluginType: PluginType, pluginName: string, type: CheckerType) {
658 const notificationType = UserNotificationType.NEW_PLUGIN_VERSION
660 function notificationChecker (notification: UserNotification, type: CheckerType) {
661 if (type === 'presence') {
662 expect(notification).to.not.be.undefined
663 expect(notification.type).to.equal(notificationType)
665 expect(notification.plugin.name).to.equal(pluginName)
666 expect(notification.plugin.type).to.equal(pluginType)
668 expect(notification).to.satisfy((n: UserNotification) => {
669 return n === undefined || n.plugin === undefined || n.plugin.name !== pluginName
674 function emailNotificationFinder (email: object) {
675 const text = email['text']
677 return text.includes(pluginName)
680 await checkNotification(base, notificationChecker, emailNotificationFinder, type)
683 function getAllNotificationsSettings (): UserNotificationSetting {
685 newVideoFromSubscription: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
686 newCommentOnMyVideo: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
687 abuseAsModerator: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
688 videoAutoBlacklistAsModerator: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
689 blacklistOnMyVideo: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
690 myVideoImportFinished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
691 myVideoPublished: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
692 commentMention: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
693 newFollow: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
694 newUserRegistration: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
695 newInstanceFollower: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
696 abuseNewMessage: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
697 abuseStateChange: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
698 autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
699 newPeerTubeVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
700 newPluginVersion: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
704 async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: any = {}) {
705 const userNotifications: UserNotification[] = []
706 const adminNotifications: UserNotification[] = []
707 const adminNotificationsServer2: UserNotification[] = []
708 const emails: object[] = []
710 const port = await MockSmtpServer.Instance.collectEmails(emails)
712 const overrideConfig = {
714 hostname: 'localhost',
721 const servers = await flushAndRunMultipleServers(serversCount, Object.assign(overrideConfig, overrideConfigArg))
723 await setAccessTokensToServers(servers)
725 if (serversCount > 1) {
726 await doubleFollow(servers[0], servers[1])
731 password: 'super password'
735 accessToken: servers[0].accessToken,
736 username: user.username,
737 password: user.password,
738 videoQuota: 10 * 1000 * 1000
740 const userAccessToken = await userLogin(servers[0], user)
742 await updateMyNotificationSettings(servers[0].url, userAccessToken, getAllNotificationsSettings())
743 await updateMyNotificationSettings(servers[0].url, servers[0].accessToken, getAllNotificationsSettings())
745 if (serversCount > 1) {
746 await updateMyNotificationSettings(servers[1].url, servers[1].accessToken, getAllNotificationsSettings())
750 const socket = servers[0].socketIOCommand.getUserNotificationSocket({ token: userAccessToken })
751 socket.on('new-notification', n => userNotifications.push(n))
754 const socket = servers[0].socketIOCommand.getUserNotificationSocket()
755 socket.on('new-notification', n => adminNotifications.push(n))
758 if (serversCount > 1) {
759 const socket = servers[1].socketIOCommand.getUserNotificationSocket()
760 socket.on('new-notification', n => adminNotificationsServer2.push(n))
763 const resChannel = await getMyUserInformation(servers[0].url, servers[0].accessToken)
764 const channelId = resChannel.body.videoChannels[0].id
769 adminNotificationsServer2,
777 // ---------------------------------------------------------------------------
782 getAllNotificationsSettings,
784 markAsReadAllNotifications,
785 checkMyVideoImportIsFinished,
787 checkAutoInstanceFollowing,
788 checkVideoIsPublished,
789 checkNewVideoFromSubscription,
791 checkNewCommentOnMyVideo,
792 checkNewBlacklistOnMyVideo,
794 updateMyNotificationSettings,
795 checkNewVideoAbuseForModerators,
796 checkVideoAutoBlacklistForModerators,
797 checkNewAbuseMessage,
798 checkAbuseStateChange,
799 getUserNotifications,
800 markAsReadNotifications,
802 checkNewInstanceFollower,
803 prepareNotificationsTest,
804 checkNewCommentAbuseForModerators,
805 checkNewAccountAbuseForModerators,
806 checkNewPeerTubeVersion,
807 checkNewPluginVersion