aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/models/video/video-comment.ts11
-rw-r--r--server/tests/feeds/feeds.ts12
2 files changed, 21 insertions, 2 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index b7ed6240e..6d60271e6 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -381,13 +381,20 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
381 return VideoCommentModel.findAndCountAll<MComment>(query) 381 return VideoCommentModel.findAndCountAll<MComment>(query)
382 } 382 }
383 383
384 static listForFeed (start: number, count: number, videoId?: number): Bluebird<MCommentOwnerVideoFeed[]> { 384 static async listForFeed (start: number, count: number, videoId?: number): Promise<MCommentOwnerVideoFeed[]> {
385 const serverActor = await getServerActor()
386
385 const query = { 387 const query = {
386 order: [ [ 'createdAt', 'DESC' ] ] as Order, 388 order: [ [ 'createdAt', 'DESC' ] ] as Order,
387 offset: start, 389 offset: start,
388 limit: count, 390 limit: count,
389 where: { 391 where: {
390 deletedAt: null 392 deletedAt: null,
393 accountId: {
394 [Op.notIn]: Sequelize.literal(
395 '(' + buildBlockedAccountSQL(serverActor.Account.id) + ')'
396 )
397 }
391 }, 398 },
392 include: [ 399 include: [
393 { 400 {
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index d978123cf..7fac921a3 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -20,6 +20,7 @@ import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-
20import { waitJobs } from '../../../shared/extra-utils/server/jobs' 20import { waitJobs } from '../../../shared/extra-utils/server/jobs'
21import { User } from '../../../shared/models/users' 21import { User } from '../../../shared/models/users'
22import { VideoPrivacy } from '@shared/models' 22import { VideoPrivacy } from '@shared/models'
23import { addAccountToServerBlocklist } from '@shared/extra-utils/users/blocklist'
23 24
24chai.use(require('chai-xml')) 25chai.use(require('chai-xml'))
25chai.use(require('chai-json-schema')) 26chai.use(require('chai-json-schema'))
@@ -216,6 +217,17 @@ describe('Test syndication feeds', () => {
216 expect(jsonObj.items[1].html_content).to.equal('super comment 1') 217 expect(jsonObj.items[1].html_content).to.equal('super comment 1')
217 } 218 }
218 }) 219 })
220
221 it('Should not list comments from muted accounts or instances', async function () {
222 await addAccountToServerBlocklist(servers[1].url, servers[1].accessToken, 'root@localhost:' + servers[0].port)
223
224 {
225 const json = await getJSONfeed(servers[1].url, 'video-comments', { version: 2 })
226 const jsonObj = JSON.parse(json.text)
227 expect(jsonObj.items.length).to.be.equal(0)
228 }
229
230 })
219 }) 231 })
220 232
221 after(async function () { 233 after(async function () {