+ describe('New abuse message notification', function () {
+ let baseParamsUser: CheckerBaseParams
+ let baseParamsAdmin: CheckerBaseParams
+ let abuseId: number
+ let abuseId2: number
+
+ before(async function () {
+ baseParamsUser = {
+ server: servers[0],
+ emails,
+ socketNotifications: userNotifications,
+ token: userToken1
+ }
+
+ baseParamsAdmin = {
+ server: servers[0],
+ emails,
+ socketNotifications: adminNotifications,
+ token: servers[0].accessToken
+ }
+
+ const name = 'abuse ' + buildUUID()
+ const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
+
+ {
+ const body = await servers[0].abuses.report({ token: userToken1, videoId: video.id, reason: 'super reason' })
+ abuseId = body.abuse.id
+ }
+
+ {
+ const body = await servers[0].abuses.report({ token: userToken1, videoId: video.id, reason: 'super reason 2' })
+ abuseId2 = body.abuse.id
+ }
+ })
+
+ it('Should send a notification to reporter on new message', async function () {
+ this.timeout(30000)
+
+ const message = 'my super message to users'
+ await servers[0].abuses.addMessage({ abuseId, message })
+ await waitJobs(servers)
+
+ await checkNewAbuseMessage({ ...baseParamsUser, abuseId, message, toEmail: 'user_1@example.com', checkType: 'presence' })
+ })
+
+ it('Should not send a notification to the admin if sent by the admin', async function () {
+ this.timeout(30000)