this.query = `${this.select} ` +
`FROM (${this.innerQuery}) AS "VideoCommentModel" ` +
`${this.joins} ` +
- `${this.getOrder()} ` +
- `${this.getLimit()}`
+ `${this.getOrder()}`
}
private buildInnerListQuery () {
return 'ORDER BY ' + orders.map(o => `"${o[0]}" ${o[1]}`).join(', ')
}
- private getLimit () {
- if (!this.options.count) return ''
-
- this.replacements.limit = this.options.count
-
- return `LIMIT :limit `
- }
-
private getInnerLimit () {
if (!this.options.count) return ''
await setDefaultAccountAvatar(server)
userAccessTokenServer1 = await server.users.generateUserAndToken('user1')
+ await setDefaultChannelAvatar(server, 'user1_channel')
+ await setDefaultAccountAvatar(server, userAccessTokenServer1)
command = server.comments
})
describe('All instance comments', function () {
it('Should list instance comments as admin', async function () {
- const { data } = await command.listForAdmin({ start: 0, count: 1 })
+ {
+ const { data, total } = await command.listForAdmin({ start: 0, count: 1 })
- expect(data[0].text).to.equal('my second answer to thread 4')
+ expect(total).to.equal(7)
+ expect(data).to.have.lengthOf(1)
+ expect(data[0].text).to.equal('my second answer to thread 4')
+ expect(data[0].account.name).to.equal('root')
+ expect(data[0].account.displayName).to.equal('root')
+ expect(data[0].account.avatars).to.have.lengthOf(2)
+ }
+
+ {
+ const { data, total } = await command.listForAdmin({ start: 1, count: 2 })
+
+ expect(total).to.equal(7)
+ expect(data).to.have.lengthOf(2)
+
+ expect(data[0].account.avatars).to.have.lengthOf(2)
+ expect(data[1].account.avatars).to.have.lengthOf(2)
+ }
})
it('Should filter instance comments by isLocal', async function () {