})
}
-function getUserNotifications (
+async function getUserNotifications (
url: string,
token: string,
start: number,
checkVideo(notification.video, videoName, videoUUID)
checkActor(notification.video.channel)
} else {
- expect(notification.video).to.satisfy(v => v === undefined || v.name !== videoName)
+ expect(notification).to.satisfy((n: UserNotification) => {
+ return n === undefined || n.type !== UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION || n.video.name !== videoName
+ })
}
}
function emailFinder (email: object) {
- return email[ 'text' ].indexOf(videoUUID) !== -1
+ const text = email[ 'text' ]
+ return text.indexOf(videoUUID) !== -1 && text.indexOf('Your subscription') !== -1
}
await checkNotification(base, notificationChecker, emailFinder, type)
checkActor(notification.actorFollow.follower)
expect(notification.actorFollow.follower.displayName).to.equal(followerDisplayName)
expect(notification.actorFollow.follower.name).to.equal(followerName)
+ expect(notification.actorFollow.follower.host).to.not.be.undefined
- checkActor(notification.actorFollow.following)
expect(notification.actorFollow.following.displayName).to.equal(followingDisplayName)
expect(notification.actorFollow.following.type).to.equal(followType)
} else {
await checkNotification(base, notificationChecker, emailFinder, type)
}
+async function checkVideoAutoBlacklistForModerators (base: CheckerBaseParams, videoUUID: string, videoName: string, type: CheckerType) {
+ const notificationType = UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS
+
+ function notificationChecker (notification: UserNotification, type: CheckerType) {
+ if (type === 'presence') {
+ expect(notification).to.not.be.undefined
+ expect(notification.type).to.equal(notificationType)
+
+ expect(notification.video.id).to.be.a('number')
+ checkVideo(notification.video, videoName, videoUUID)
+ } else {
+ expect(notification).to.satisfy((n: UserNotification) => {
+ return n === undefined || n.video === undefined || n.video.uuid !== videoUUID
+ })
+ }
+ }
+
+ function emailFinder (email: object) {
+ const text = email[ 'text' ]
+ return text.indexOf(videoUUID) !== -1 && email[ 'text' ].indexOf('video-auto-blacklist/list') !== -1
+ }
+
+ await checkNotification(base, notificationChecker, emailFinder, type)
+}
+
async function checkNewBlacklistOnMyVideo (
base: CheckerBaseParams,
videoUUID: string,
checkCommentMention,
updateMyNotificationSettings,
checkNewVideoAbuseForModerators,
+ checkVideoAutoBlacklistForModerators,
getUserNotifications,
markAsReadNotifications,
getLastNotification