updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd
} from '../../utils'
import {
- addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,
+ addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads,
getVideoThreadComments
} from '../../utils/videos/video-comments'
duration: 10,
tags: [ 'tag1p1', 'tag2p1' ],
privacy: VideoPrivacy.PUBLIC,
+ commentsEnabled: true,
channel: {
name: 'my channel',
description: 'super channel',
isLocal
},
- fixture: 'video_short.webm',
+ fixture: 'video_short1.webm',
files: [
{
resolution: 720,
host: 'localhost:9002',
account: 'user1',
isLocal,
+ commentsEnabled: true,
duration: 5,
tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
privacy: VideoPrivacy.PUBLIC,
account: 'root',
isLocal,
duration: 5,
+ commentsEnabled: true,
tags: [ 'tag1p3' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
description: 'my super description for server 3-2',
host: 'localhost:9003',
account: 'root',
+ commentsEnabled: true,
isLocal,
duration: 5,
tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
description: '',
isLocal
},
- fixture: 'video_short3.webm',
+ fixture: 'video_short.webm',
files: [
{
resolution: 720,
account: 'root',
isLocal,
duration: 5,
+ commentsEnabled: true,
tags: [ 'tag_up_1', 'tag_up_2' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
expect(secondChild.children).to.have.lengthOf(0)
}
})
+
+ it('Should delete the thread comments', async function () {
+ this.timeout(10000)
+
+ const res1 = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 5)
+ const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
+ await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)
+
+ await wait(5000)
+ })
+
+ it('Should have the thread comments deleted on other servers too', async function () {
+ for (const server of servers) {
+ const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
+
+ expect(res.body.total).to.equal(1)
+ expect(res.body.data).to.be.an('array')
+ expect(res.body.data).to.have.lengthOf(1)
+
+ {
+ const comment: VideoComment = res.body.data[0]
+ expect(comment).to.not.be.undefined
+ expect(comment.inReplyToCommentId).to.be.null
+ expect(comment.account.name).to.equal('root')
+ expect(comment.account.host).to.equal('localhost:9003')
+ expect(comment.totalReplies).to.equal(0)
+ expect(dateIsValid(comment.createdAt as string)).to.be.true
+ expect(dateIsValid(comment.updatedAt as string)).to.be.true
+ }
+ }
+ })
+
+ it('Should disable comments', async function () {
+ this.timeout(20000)
+
+ const attributes = {
+ commentsEnabled: false
+ }
+
+ await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
+
+ await wait(5000)
+
+ for (const server of servers) {
+ const res = await getVideo(server.url, videoUUID)
+ expect(res.body.commentsEnabled).to.be.false
+
+ const text = 'my super forbidden comment'
+ await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409)
+ }
+ })
})
describe('With minimum parameters', function () {
.field('privacy', '1')
.field('nsfw', 'false')
.field('channelId', '1')
+ .field('commentsEnabled', 'true')
const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm')
account: 'root',
isLocal,
duration: 5,
+ commentsEnabled: true,
tags: [ ],
privacy: VideoPrivacy.PUBLIC,
channel: {