+ 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 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 resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'hello @user_1@localhost:9001 1')
+ const threadId = resThread.body.comment.id
+
+ await waitJobs(servers)
+ await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root 2 name', 'presence')
+
+ const text = '@user_1@localhost:9001 hello 2 @root@localhost:9001'
+ const resComment = await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, threadId, text)
+ const commentId = resComment.body.comment.id
+
+ await waitJobs(servers)
+ await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root 2 name', 'presence')
+ })
+ })
+