- const resThread = await getVideoCommentThreads(servers[0].url, uuid, 0, 5)
- expect(resThread.body.data).to.have.lengthOf(1)
- const threadId = resThread.body.data[0].id
-
- const resComments = await getVideoThreadComments(servers[0].url, uuid, threadId)
- const tree = resComments.body as VideoCommentThreadTree
-
- expect(tree.children).to.have.lengthOf(1)
- const commentId = tree.children[0].comment.id
-
- await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence')
- })
- })
-
- describe('Mention notifications', function () {
- let baseParams: CheckerBaseParams
-
- before(async () => {
- baseParams = {
- server: servers[0],
- emails,
- socketNotifications: userNotifications,
- token: userAccessToken
- }
-
- await updateMyUser({
- url: servers[0].url,
- accessToken: servers[0].accessToken,
- displayName: 'super root name'
- })
-
- await updateMyUser({
- url: servers[1].url,
- accessToken: servers[1].accessToken,
- displayName: 'super root 2 name'
- })
- })
-
- it('Should not send a new mention comment notification if I mention the video owner', async function () {
- this.timeout(10000)
-
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'super video' })
- const uuid = resVideo.body.video.uuid
-
- const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello')
- const commentId = resComment.body.comment.id
-
- await wait(500)
- await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
- })
-
- it('Should not send a new mention comment notification if I mention myself', async function () {
- this.timeout(10000)
-
- const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
- const uuid = resVideo.body.video.uuid
-
- const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, '@user_1 hello')
- const commentId = resComment.body.comment.id
-
- await wait(500)
- await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
- })
-
- it('Should not send a new mention notification if the account is muted', async function () {
- this.timeout(10000)
-
- await addAccountToAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
-
- const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
- const uuid = resVideo.body.video.uuid
-
- const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello')
- const commentId = resComment.body.comment.id
-
- await wait(500)
- await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
-
- await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
- })
-
- it('Should not send a new mention notification if the remote account mention a local account', async function () {
- this.timeout(20000)
-
- const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
- const uuid = resVideo.body.video.uuid
-
- await waitJobs(servers)
- const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, '@user_1 hello')
- const threadId = resThread.body.comment.id
-
- await waitJobs(servers)
- await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root 2 name', 'absence')
- })
-
- it('Should send a new mention notification after local comments', async function () {
- this.timeout(10000)
-
- const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
- const uuid = resVideo.body.video.uuid
-
- const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1')
- const threadId = resThread.body.comment.id
-
- await wait(500)
- await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence')
-
- const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'hello 2 @user_1')
- const commentId = resComment.body.comment.id
-
- await wait(500)
- await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence')
- })
-
- it('Should send a new mention notification after remote comments', async function () {
- this.timeout(20000)
-
- const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
- const uuid = resVideo.body.video.uuid
-
- await waitJobs(servers)
-
- const text1 = `hello @user_1@localhost:${servers[ 0 ].port} 1`
- const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, text1)
- const server2ThreadId = resThread.body.comment.id
-
- await waitJobs(servers)
-
- const resThread2 = await getVideoCommentThreads(servers[0].url, uuid, 0, 5)
- expect(resThread2.body.data).to.have.lengthOf(1)
- const server1ThreadId = resThread2.body.data[0].id
- await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence')
-
- const text2 = `@user_1@localhost:${servers[ 0 ].port} hello 2 @root@localhost:${servers[ 0 ].port}`
- await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text2)
-
- await waitJobs(servers)
-
- const resComments = await getVideoThreadComments(servers[0].url, uuid, server1ThreadId)
- const tree = resComments.body as VideoCommentThreadTree
-
- expect(tree.children).to.have.lengthOf(1)
- const commentId = tree.children[0].comment.id
-
- await checkCommentMention(baseParams, uuid, commentId, server1ThreadId, 'super root 2 name', 'presence')
- })
- })
-
- describe('Video abuse for moderators notification' , function () {
- let baseParams: CheckerBaseParams
-
- before(() => {
- baseParams = {
- server: servers[0],
- emails,
- socketNotifications: adminNotifications,
- token: servers[0].accessToken
- }
- })
-
- it('Should send a notification to moderators on local video abuse', async function () {
- this.timeout(10000)
-
- const name = 'video for abuse ' + uuidv4()
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const uuid = resVideo.body.video.uuid
-
- await reportVideoAbuse(servers[0].url, servers[0].accessToken, uuid, 'super reason')
-
- await waitJobs(servers)
- await checkNewVideoAbuseForModerators(baseParams, uuid, name, 'presence')
- })
-
- it('Should send a notification to moderators on remote video abuse', async function () {
- this.timeout(10000)
-
- const name = 'video for abuse ' + uuidv4()
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const uuid = resVideo.body.video.uuid
-
- await waitJobs(servers)
-
- await reportVideoAbuse(servers[1].url, servers[1].accessToken, uuid, 'super reason')
-
- await waitJobs(servers)
- await checkNewVideoAbuseForModerators(baseParams, uuid, name, 'presence')
- })
- })
-
- describe('Video blacklist on my video', function () {
- let baseParams: CheckerBaseParams
-
- before(() => {
- baseParams = {
- server: servers[0],
- emails,
- socketNotifications: userNotifications,
- token: userAccessToken
- }
- })
-
- it('Should send a notification to video owner on blacklist', async function () {
- this.timeout(10000)
-
- const name = 'video for abuse ' + uuidv4()
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const uuid = resVideo.body.video.uuid
-
- await addVideoToBlacklist(servers[0].url, servers[0].accessToken, uuid)
-
- await waitJobs(servers)
- await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'blacklist')
- })
-
- it('Should send a notification to video owner on unblacklist', async function () {
- this.timeout(10000)
-
- const name = 'video for abuse ' + uuidv4()
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const uuid = resVideo.body.video.uuid
-
- await addVideoToBlacklist(servers[0].url, servers[0].accessToken, uuid)
-
- await waitJobs(servers)
- await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, uuid)
- await waitJobs(servers)
-
- await wait(500)
- await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'unblacklist')