diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-08 20:34:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-08 20:34:37 +0200 |
commit | fe3a55b071c99b346e9e9ab786f5d219e5a064cd (patch) | |
tree | 55c6d0e9a253b20df738fd82820eb931044828e6 /server/models/video/video-comment.ts | |
parent | 4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4 (diff) | |
download | PeerTube-fe3a55b071c99b346e9e9ab786f5d219e5a064cd.tar.gz PeerTube-fe3a55b071c99b346e9e9ab786f5d219e5a064cd.tar.zst PeerTube-fe3a55b071c99b346e9e9ab786f5d219e5a064cd.zip |
Add video comments RSS
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r-- | server/models/video/video-comment.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 18398905e..353fb1a0e 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -340,6 +340,28 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
340 | return VideoCommentModel.findAndCountAll(query) | 340 | return VideoCommentModel.findAndCountAll(query) |
341 | } | 341 | } |
342 | 342 | ||
343 | static listForFeed (start: number, count: number, videoId?: number) { | ||
344 | const query = { | ||
345 | order: [ [ 'createdAt', 'DESC' ] ], | ||
346 | start, | ||
347 | count, | ||
348 | where: {}, | ||
349 | include: [ | ||
350 | { | ||
351 | attributes: [ 'name' ], | ||
352 | model: VideoModel.unscoped(), | ||
353 | required: true | ||
354 | } | ||
355 | ] | ||
356 | } | ||
357 | |||
358 | if (videoId) query.where['videoId'] = videoId | ||
359 | |||
360 | return VideoCommentModel | ||
361 | .scope([ ScopeNames.WITH_ACCOUNT ]) | ||
362 | .findAll(query) | ||
363 | } | ||
364 | |||
343 | static async getStats () { | 365 | static async getStats () { |
344 | const totalLocalVideoComments = await VideoCommentModel.count({ | 366 | const totalLocalVideoComments = await VideoCommentModel.count({ |
345 | include: [ | 367 | include: [ |