aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+admin/admin.component.ts11
-rw-r--r--client/src/app/+admin/admin.module.ts4
-rw-r--r--client/src/app/+admin/moderation/moderation.routes.ts24
-rw-r--r--client/src/app/+admin/moderation/video-comment-list/index.ts1
-rw-r--r--client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html102
-rw-r--r--client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss27
-rw-r--r--client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts111
-rw-r--r--client/src/app/shared/shared-video-comment/video-comment.model.ts52
-rw-r--r--client/src/app/shared/shared-video-comment/video-comment.service.ts45
-rw-r--r--server/controllers/api/videos/comment.ts36
-rw-r--r--server/initializers/constants.ts3
-rw-r--r--server/middlewares/validators/sort.ts3
-rw-r--r--server/middlewares/validators/videos/video-comments.ts32
-rw-r--r--server/models/video/video-comment.ts132
-rw-r--r--server/types/models/video/video-comment.ts9
-rw-r--r--shared/core-utils/users/user-role.ts3
-rw-r--r--shared/models/users/user-right.enum.ts1
-rw-r--r--shared/models/videos/video-comment.model.ts20
18 files changed, 602 insertions, 14 deletions
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts
index b661a5517..dd92ed2ca 100644
--- a/client/src/app/+admin/admin.component.ts
+++ b/client/src/app/+admin/admin.component.ts
@@ -62,6 +62,13 @@ export class AdminComponent implements OnInit {
62 iconName: 'cross' 62 iconName: 'cross'
63 }) 63 })
64 } 64 }
65 if (this.hasVideoCommentsRight()) {
66 moderationItems.children.push({
67 label: $localize`Video comments`,
68 routerLink: '/admin/moderation/video-comments/list',
69 iconName: 'message-circle'
70 })
71 }
65 if (this.hasAccountsBlocklistRight()) { 72 if (this.hasAccountsBlocklistRight()) {
66 moderationItems.children.push({ 73 moderationItems.children.push({
67 label: $localize`Muted accounts`, 74 label: $localize`Muted accounts`,
@@ -140,4 +147,8 @@ export class AdminComponent implements OnInit {
140 hasDebugRight () { 147 hasDebugRight () {
141 return this.auth.getUser().hasRight(UserRight.MANAGE_DEBUG) 148 return this.auth.getUser().hasRight(UserRight.MANAGE_DEBUG)
142 } 149 }
150
151 hasVideoCommentsRight () {
152 return this.auth.getUser().hasRight(UserRight.SEE_ALL_COMMENTS)
153 }
143} 154}
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts
index da517a55b..5c0864f48 100644
--- a/client/src/app/+admin/admin.module.ts
+++ b/client/src/app/+admin/admin.module.ts
@@ -7,6 +7,7 @@ import { SharedFormModule } from '@app/shared/shared-forms'
7import { SharedGlobalIconModule } from '@app/shared/shared-icons' 7import { SharedGlobalIconModule } from '@app/shared/shared-icons'
8import { SharedMainModule } from '@app/shared/shared-main' 8import { SharedMainModule } from '@app/shared/shared-main'
9import { SharedModerationModule } from '@app/shared/shared-moderation' 9import { SharedModerationModule } from '@app/shared/shared-moderation'
10import { SharedVideoCommentModule } from '@app/shared/shared-video-comment'
10import { AdminRoutingModule } from './admin-routing.module' 11import { AdminRoutingModule } from './admin-routing.module'
11import { AdminComponent } from './admin.component' 12import { AdminComponent } from './admin.component'
12import { ConfigComponent, EditCustomConfigComponent } from './config' 13import { ConfigComponent, EditCustomConfigComponent } from './config'
@@ -18,6 +19,7 @@ import { VideoRedundancyInformationComponent } from './follows/video-redundancie
18import { AbuseListComponent, VideoBlockListComponent } from './moderation' 19import { AbuseListComponent, VideoBlockListComponent } from './moderation'
19import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from './moderation/instance-blocklist' 20import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from './moderation/instance-blocklist'
20import { ModerationComponent } from './moderation/moderation.component' 21import { ModerationComponent } from './moderation/moderation.component'
22import { VideoCommentListComponent } from './moderation/video-comment-list'
21import { PluginListInstalledComponent } from './plugins/plugin-list-installed/plugin-list-installed.component' 23import { PluginListInstalledComponent } from './plugins/plugin-list-installed/plugin-list-installed.component'
22import { PluginSearchComponent } from './plugins/plugin-search/plugin-search.component' 24import { PluginSearchComponent } from './plugins/plugin-search/plugin-search.component'
23import { PluginShowInstalledComponent } from './plugins/plugin-show-installed/plugin-show-installed.component' 25import { PluginShowInstalledComponent } from './plugins/plugin-show-installed/plugin-show-installed.component'
@@ -37,6 +39,7 @@ import { UserCreateComponent, UserListComponent, UserPasswordComponent, UsersCom
37 SharedModerationModule, 39 SharedModerationModule,
38 SharedGlobalIconModule, 40 SharedGlobalIconModule,
39 SharedAbuseListModule, 41 SharedAbuseListModule,
42 SharedVideoCommentModule,
40 43
41 TableModule, 44 TableModule,
42 SelectButtonModule, 45 SelectButtonModule,
@@ -62,6 +65,7 @@ import { UserCreateComponent, UserListComponent, UserPasswordComponent, UsersCom
62 ModerationComponent, 65 ModerationComponent,
63 VideoBlockListComponent, 66 VideoBlockListComponent,
64 AbuseListComponent, 67 AbuseListComponent,
68 VideoCommentListComponent,
65 69
66 InstanceServerBlocklistComponent, 70 InstanceServerBlocklistComponent,
67 InstanceAccountBlocklistComponent, 71 InstanceAccountBlocklistComponent,
diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.ts
index b60dd5334..2e28f0911 100644
--- a/client/src/app/+admin/moderation/moderation.routes.ts
+++ b/client/src/app/+admin/moderation/moderation.routes.ts
@@ -1,8 +1,9 @@
1import { Routes } from '@angular/router' 1import { Routes } from '@angular/router'
2import { AbuseListComponent } from '@app/+admin/moderation/abuse-list'
2import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist' 3import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist'
3import { ModerationComponent } from '@app/+admin/moderation/moderation.component' 4import { ModerationComponent } from '@app/+admin/moderation/moderation.component'
4import { AbuseListComponent } from '@app/+admin/moderation/abuse-list'
5import { VideoBlockListComponent } from '@app/+admin/moderation/video-block-list' 5import { VideoBlockListComponent } from '@app/+admin/moderation/video-block-list'
6import { VideoCommentListComponent } from './video-comment-list'
6import { UserRightGuard } from '@app/core' 7import { UserRightGuard } from '@app/core'
7import { UserRight } from '@shared/models' 8import { UserRight } from '@shared/models'
8 9
@@ -37,6 +38,7 @@ export const ModerationRoutes: Routes = [
37 } 38 }
38 } 39 }
39 }, 40 },
41
40 { 42 {
41 path: 'video-blacklist', 43 path: 'video-blacklist',
42 redirectTo: 'video-blocks/list', 44 redirectTo: 'video-blocks/list',
@@ -64,10 +66,28 @@ export const ModerationRoutes: Routes = [
64 data: { 66 data: {
65 userRight: UserRight.MANAGE_VIDEO_BLACKLIST, 67 userRight: UserRight.MANAGE_VIDEO_BLACKLIST,
66 meta: { 68 meta: {
67 title: $localize`Videos blocked` 69 title: $localize`Blocked videos`
68 } 70 }
69 } 71 }
70 }, 72 },
73
74 {
75 path: 'video-comments',
76 redirectTo: 'video-comments/list',
77 pathMatch: 'full'
78 },
79 {
80 path: 'video-comments/list',
81 component: VideoCommentListComponent,
82 canActivate: [ UserRightGuard ],
83 data: {
84 userRight: UserRight.SEE_ALL_COMMENTS,
85 meta: {
86 title: $localize`Video comments`
87 }
88 }
89 },
90
71 { 91 {
72 path: 'blocklist/accounts', 92 path: 'blocklist/accounts',
73 component: InstanceAccountBlocklistComponent, 93 component: InstanceAccountBlocklistComponent,
diff --git a/client/src/app/+admin/moderation/video-comment-list/index.ts b/client/src/app/+admin/moderation/video-comment-list/index.ts
new file mode 100644
index 000000000..eb08b4177
--- /dev/null
+++ b/client/src/app/+admin/moderation/video-comment-list/index.ts
@@ -0,0 +1 @@
export * from './video-comment-list.component'
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html
new file mode 100644
index 000000000..b4f66a75f
--- /dev/null
+++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html
@@ -0,0 +1,102 @@
1<h1>
2 <my-global-icon iconName="cross" aria-hidden="true"></my-global-icon>
3 <ng-container i18n>Video comments</ng-container>
4</h1>
5
6this view does show comments from muted accounts so you can delete them
7
8<p-table
9 [value]="comments" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
10 [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
11 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
12 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} comments"
13 (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
14>
15 <ng-template pTemplate="caption">
16 <div class="caption">
17 <div class="ml-auto">
18 <div class="input-group has-feedback has-clear">
19 <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body">
20 <div class="input-group-text" ngbDropdownToggle>
21 <span class="caret" aria-haspopup="menu" role="button"></span>
22 </div>
23
24 <div role="menu" ngbDropdownMenu>
25 <h6 class="dropdown-header" i18n>Advanced comments filters</h6>
26 <a [routerLink]="[ '/admin/moderation/video-comments/list' ]" [queryParams]="{ 'search': 'local:true' }" class="dropdown-item" i18n>Local comments</a>
27 <a [routerLink]="[ '/admin/moderation/video-comments/list' ]" [queryParams]="{ 'search': 'local:false' }" class="dropdown-item" i18n>Remote comments</a>
28 </div>
29 </div>
30 <input
31 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
32 (keyup)="onSearch($event)"
33 >
34 <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a>
35 <span class="sr-only" i18n>Clear filters</span>
36 </div>
37 </div>
38 </div>
39 </ng-template>
40
41 <ng-template pTemplate="header">
42 <tr>
43 <th style="width: 40px"></th>
44 <th style="width: 100px;" i18n>Account</th>
45 <th style="width: 100px;" i18n>Video</th>
46 <th style="width: 100px;" i18n>Comment</th>
47 <th style="width: 150px;" i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th>
48 <th style="width: 150px;"></th>
49 </tr>
50 </ng-template>
51
52 <ng-template pTemplate="body" let-videoComment let-expanded="expanded">
53 <tr>
54 <td class="expand-cell c-hand" [pRowToggler]="videoComment" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body">
55 <span class="expander">
56 <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
57 </span>
58 </td>
59
60 <td>
61 {{ videoComment.by }}
62 </td>
63
64 <td>
65 {{ videoComment.video.name }}
66 </td>
67
68 <td>
69 <div [innerHTML]="videoComment.textHtml"></div>
70 </td>
71
72 <td>{{ videoComment.createdAt | date: 'short' }}</td>
73
74 <td class="action-cell">
75 <my-action-dropdown
76 [ngClass]="{ 'show': expanded }" placement="bottom-right" container="body"
77 i18n-label label="Actions" [actions]="videoCommentActions" [entry]="videoComment"
78 ></my-action-dropdown>
79 </td>
80 </tr>
81 </ng-template>
82
83 <ng-template pTemplate="rowexpansion" let-videoComment>
84 <tr>
85 <td class="expand-cell" colspan="5">
86 <div [innerHTML]="videoComment.textHtml"></div>
87 </td>
88 </tr>
89 </ng-template>
90
91 <ng-template pTemplate="emptymessage">
92 <tr>
93 <td colspan="5">
94 <div class="no-results">
95 <ng-container *ngIf="search" i18n>No comments found matching current filters.</ng-container>
96 <ng-container *ngIf="!search" i18n>No comments found.</ng-container>
97 </div>
98 </td>
99 </tr>
100 </ng-template>
101</p-table>
102
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss
new file mode 100644
index 000000000..c92d1c39c
--- /dev/null
+++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss
@@ -0,0 +1,27 @@
1@import 'mixins';
2
3my-global-icon {
4 @include apply-svg-color(#7d7d7d);
5
6 width: 12px;
7 height: 12px;
8 position: relative;
9 top: -1px;
10}
11
12.input-group {
13 @include peertube-input-group(300px);
14
15 .dropdown-toggle::after {
16 margin-left: 0;
17 }
18}
19
20.caption {
21 justify-content: flex-end;
22
23 input {
24 @include peertube-input-text(250px);
25 flex-grow: 1;
26 }
27}
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts
new file mode 100644
index 000000000..fdd5ec76e
--- /dev/null
+++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts
@@ -0,0 +1,111 @@
1import { SortMeta } from 'primeng/api'
2import { filter } from 'rxjs/operators'
3import { AfterViewInit, Component, OnInit } from '@angular/core'
4import { DomSanitizer } from '@angular/platform-browser'
5import { ActivatedRoute, Params, Router } from '@angular/router'
6import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
7import { DropdownAction, VideoService } from '@app/shared/shared-main'
8import { VideoCommentAdmin, VideoCommentService } from '@app/shared/shared-video-comment'
9
10@Component({
11 selector: 'my-video-comment-list',
12 templateUrl: './video-comment-list.component.html',
13 styleUrls: [ './video-comment-list.component.scss' ]
14})
15export class VideoCommentListComponent extends RestTable implements OnInit, AfterViewInit {
16 comments: VideoCommentAdmin[]
17 totalRecords = 0
18 sort: SortMeta = { field: 'createdAt', order: -1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20
21 videoCommentActions: DropdownAction<VideoCommentAdmin>[][] = []
22
23 constructor (
24 private notifier: Notifier,
25 private serverService: ServerService,
26 private confirmService: ConfirmService,
27 private videoCommentService: VideoCommentService,
28 private markdownRenderer: MarkdownService,
29 private sanitizer: DomSanitizer,
30 private videoService: VideoService,
31 private route: ActivatedRoute,
32 private router: Router
33 ) {
34 super()
35
36 this.videoCommentActions = [
37 [
38
39 // remove this comment,
40
41 // remove all comments of this account
42
43 ]
44 ]
45 }
46
47 ngOnInit () {
48 this.initialize()
49
50 this.route.queryParams
51 .pipe(filter(params => params.search !== undefined && params.search !== null))
52 .subscribe(params => {
53 this.search = params.search
54 this.setTableFilter(params.search)
55 this.loadData()
56 })
57 }
58
59 ngAfterViewInit () {
60 if (this.search) this.setTableFilter(this.search)
61 }
62
63 onSearch (event: Event) {
64 this.onSearch(event)
65 this.setQueryParams((event.target as HTMLInputElement).value)
66 }
67
68 setQueryParams (search: string) {
69 const queryParams: Params = {}
70
71 if (search) Object.assign(queryParams, { search })
72 this.router.navigate([ '/admin/moderation/video-comments/list' ], { queryParams })
73 }
74
75 resetTableFilter () {
76 this.setTableFilter('')
77 this.setQueryParams('')
78 this.resetSearch()
79 }
80 /* END Table filter functions */
81
82 getIdentifier () {
83 return 'VideoCommentListComponent'
84 }
85
86 toHtml (text: string) {
87 return this.markdownRenderer.textMarkdownToHTML(text)
88 }
89
90 protected loadData () {
91 this.videoCommentService.getAdminVideoComments({
92 pagination: this.pagination,
93 sort: this.sort,
94 search: this.search
95 }).subscribe(
96 async resultList => {
97 this.totalRecords = resultList.total
98
99 this.comments = []
100
101 for (const c of resultList.data) {
102 this.comments.push(
103 new VideoCommentAdmin(c, await this.toHtml(c.text))
104 )
105 }
106 },
107
108 err => this.notifier.error(err.message)
109 )
110 }
111}
diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts
index e85443196..1589091e5 100644
--- a/client/src/app/shared/shared-video-comment/video-comment.model.ts
+++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts
@@ -1,6 +1,6 @@
1import { getAbsoluteAPIUrl } from '@app/helpers' 1import { getAbsoluteAPIUrl } from '@app/helpers'
2import { Actor } from '@app/shared/shared-main' 2import { Actor } from '@app/shared/shared-main'
3import { Account as AccountInterface, VideoComment as VideoCommentServerModel } from '@shared/models' 3import { Account as AccountInterface, VideoComment as VideoCommentServerModel, VideoCommentAdmin as VideoCommentAdminServerModel } from '@shared/models'
4 4
5export class VideoComment implements VideoCommentServerModel { 5export class VideoComment implements VideoCommentServerModel {
6 id: number 6 id: number
@@ -46,3 +46,53 @@ export class VideoComment implements VideoCommentServerModel {
46 } 46 }
47 } 47 }
48} 48}
49
50export class VideoCommentAdmin implements VideoCommentAdminServerModel {
51 id: number
52 url: string
53 text: string
54 textHtml: string
55
56 threadId: number
57 inReplyToCommentId: number
58
59 createdAt: Date | string
60 updatedAt: Date | string
61
62 account: AccountInterface
63
64 video: {
65 id: number
66 uuid: string
67 name: string
68 }
69
70 by: string
71 accountAvatarUrl: string
72
73 constructor (hash: VideoCommentAdminServerModel, textHtml: string) {
74 this.id = hash.id
75 this.url = hash.url
76 this.text = hash.text
77 this.textHtml = textHtml
78
79 this.threadId = hash.threadId
80 this.inReplyToCommentId = hash.inReplyToCommentId
81
82 this.createdAt = new Date(hash.createdAt.toString())
83 this.updatedAt = new Date(hash.updatedAt.toString())
84
85 this.video = {
86 id: hash.video.id,
87 uuid: hash.video.uuid,
88 name: hash.video.name
89 }
90
91 this.account = hash.account
92
93 if (this.account) {
94 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
95 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
96 }
97 }
98}
diff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.ts
index 81c65aa38..e318e069d 100644
--- a/client/src/app/shared/shared-video-comment/video-comment.service.ts
+++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts
@@ -2,18 +2,20 @@ import { Observable } from 'rxjs'
2import { catchError, map } from 'rxjs/operators' 2import { catchError, map } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' 5import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core'
6import { objectLineFeedToHtml } from '@app/helpers' 6import { objectLineFeedToHtml } from '@app/helpers'
7import { 7import {
8 FeedFormat, 8 FeedFormat,
9 ResultList, 9 ResultList,
10 VideoComment as VideoCommentServerModel, 10 VideoComment as VideoCommentServerModel,
11 VideoCommentAdmin,
11 VideoCommentCreate, 12 VideoCommentCreate,
12 VideoCommentThreadTree as VideoCommentThreadTreeServerModel 13 VideoCommentThreadTree as VideoCommentThreadTreeServerModel
13} from '@shared/models' 14} from '@shared/models'
14import { environment } from '../../../environments/environment' 15import { environment } from '../../../environments/environment'
15import { VideoCommentThreadTree } from './video-comment-thread-tree.model' 16import { VideoCommentThreadTree } from './video-comment-thread-tree.model'
16import { VideoComment } from './video-comment.model' 17import { VideoComment } from './video-comment.model'
18import { SortMeta } from 'primeng/api'
17 19
18@Injectable() 20@Injectable()
19export class VideoCommentService { 21export class VideoCommentService {
@@ -48,6 +50,27 @@ export class VideoCommentService {
48 ) 50 )
49 } 51 }
50 52
53 getAdminVideoComments (options: {
54 pagination: RestPagination,
55 sort: SortMeta,
56 search?: string
57 }): Observable<ResultList<VideoCommentAdmin>> {
58 const { pagination, sort, search } = options
59 const url = VideoCommentService.BASE_VIDEO_URL + '/comments'
60
61 let params = new HttpParams()
62 params = this.restService.addRestGetParams(params, pagination, sort)
63
64 if (search) {
65 params = this.buildParamsFromSearch(search, params)
66 }
67
68 return this.authHttp.get<ResultList<VideoCommentAdmin>>(url, { params })
69 .pipe(
70 catchError(res => this.restExtractor.handleError(res))
71 )
72 }
73
51 getVideoCommentThreads (parameters: { 74 getVideoCommentThreads (parameters: {
52 videoId: number | string, 75 videoId: number | string,
53 componentPagination: ComponentPaginationLight, 76 componentPagination: ComponentPaginationLight,
@@ -146,4 +169,24 @@ export class VideoCommentService {
146 169
147 return tree as VideoCommentThreadTree 170 return tree as VideoCommentThreadTree
148 } 171 }
172
173 private buildParamsFromSearch (search: string, params: HttpParams) {
174 const filters = this.restService.parseQueryStringFilter(search, {
175 state: {
176 prefix: 'local:',
177 isBoolean: true,
178 handler: v => {
179 if (v === 'true') return v
180 if (v === 'false') return v
181
182 return undefined
183 }
184 },
185
186 searchAccount: { prefix: 'account:' },
187 searchVideo: { prefix: 'video:' }
188 })
189
190 return this.restService.addObjectParams(params, filters)
191 }
149} 192}
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
index 45ff969d9..ccd76c093 100644
--- a/server/controllers/api/videos/comment.ts
+++ b/server/controllers/api/videos/comment.ts
@@ -1,5 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { ResultList } from '../../../../shared/models' 2import { ResultList, UserRight } from '../../../../shared/models'
3import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' 3import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model'
4import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' 4import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
5import { getFormattedObjects } from '../../../helpers/utils' 5import { getFormattedObjects } from '../../../helpers/utils'
@@ -11,6 +11,7 @@ import {
11 asyncMiddleware, 11 asyncMiddleware,
12 asyncRetryTransactionMiddleware, 12 asyncRetryTransactionMiddleware,
13 authenticate, 13 authenticate,
14 ensureUserHasRight,
14 optionalAuthenticate, 15 optionalAuthenticate,
15 paginationValidator, 16 paginationValidator,
16 setDefaultPagination, 17 setDefaultPagination,
@@ -19,9 +20,11 @@ import {
19import { 20import {
20 addVideoCommentReplyValidator, 21 addVideoCommentReplyValidator,
21 addVideoCommentThreadValidator, 22 addVideoCommentThreadValidator,
23 listVideoCommentsValidator,
22 listVideoCommentThreadsValidator, 24 listVideoCommentThreadsValidator,
23 listVideoThreadCommentsValidator, 25 listVideoThreadCommentsValidator,
24 removeVideoCommentValidator, 26 removeVideoCommentValidator,
27 videoCommentsValidator,
25 videoCommentThreadsSortValidator 28 videoCommentThreadsSortValidator
26} from '../../../middlewares/validators' 29} from '../../../middlewares/validators'
27import { AccountModel } from '../../../models/account/account' 30import { AccountModel } from '../../../models/account/account'
@@ -61,6 +64,17 @@ videoCommentRouter.delete('/:videoId/comments/:commentId',
61 asyncRetryTransactionMiddleware(removeVideoComment) 64 asyncRetryTransactionMiddleware(removeVideoComment)
62) 65)
63 66
67videoCommentRouter.get('/comments',
68 authenticate,
69 ensureUserHasRight(UserRight.SEE_ALL_COMMENTS),
70 paginationValidator,
71 videoCommentsValidator,
72 setDefaultSort,
73 setDefaultPagination,
74 listVideoCommentsValidator,
75 asyncMiddleware(listComments)
76)
77
64// --------------------------------------------------------------------------- 78// ---------------------------------------------------------------------------
65 79
66export { 80export {
@@ -69,6 +83,26 @@ export {
69 83
70// --------------------------------------------------------------------------- 84// ---------------------------------------------------------------------------
71 85
86async function listComments (req: express.Request, res: express.Response) {
87 const options = {
88 start: req.query.start,
89 count: req.query.count,
90 sort: req.query.sort,
91
92 isLocal: req.query.isLocal,
93 search: req.query.search,
94 searchAccount: req.query.searchAccount,
95 searchVideo: req.query.searchVideo
96 }
97
98 const resultList = await VideoCommentModel.listCommentsForApi(options)
99
100 return res.json({
101 total: resultList.total,
102 data: resultList.data.map(c => c.toFormattedAdminJSON())
103 })
104}
105
72async function listVideoThreads (req: express.Request, res: express.Response) { 106async function listVideoThreads (req: express.Request, res: express.Response) {
73 const video = res.locals.onlyVideo 107 const video = res.locals.onlyVideo
74 const user = res.locals.oauth ? res.locals.oauth.token.User : undefined 108 const user = res.locals.oauth ? res.locals.oauth.token.User : undefined
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 02e42a594..fde87d9f8 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -63,7 +63,10 @@ const SORTABLE_COLUMNS = {
63 JOBS: [ 'createdAt' ], 63 JOBS: [ 'createdAt' ],
64 VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], 64 VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ],
65 VIDEO_IMPORTS: [ 'createdAt' ], 65 VIDEO_IMPORTS: [ 'createdAt' ],
66
66 VIDEO_COMMENT_THREADS: [ 'createdAt', 'totalReplies' ], 67 VIDEO_COMMENT_THREADS: [ 'createdAt', 'totalReplies' ],
68 VIDEO_COMMENTS: [ 'createdAt' ],
69
67 VIDEO_RATES: [ 'createdAt' ], 70 VIDEO_RATES: [ 'createdAt' ],
68 BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ], 71 BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ],
69 FOLLOWERS: [ 'createdAt', 'state', 'score' ], 72 FOLLOWERS: [ 'createdAt', 'state', 'score' ],
diff --git a/server/middlewares/validators/sort.ts b/server/middlewares/validators/sort.ts
index 29aba0436..e93ceb200 100644
--- a/server/middlewares/validators/sort.ts
+++ b/server/middlewares/validators/sort.ts
@@ -10,6 +10,7 @@ const SORTABLE_VIDEOS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEOS)
10const SORTABLE_VIDEOS_SEARCH_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEOS_SEARCH) 10const SORTABLE_VIDEOS_SEARCH_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEOS_SEARCH)
11const SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_CHANNELS_SEARCH) 11const SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_CHANNELS_SEARCH)
12const SORTABLE_VIDEO_IMPORTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_IMPORTS) 12const SORTABLE_VIDEO_IMPORTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_IMPORTS)
13const SORTABLE_VIDEO_COMMENTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_COMMENT_THREADS)
13const SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_COMMENT_THREADS) 14const SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_COMMENT_THREADS)
14const SORTABLE_VIDEO_RATES_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_RATES) 15const SORTABLE_VIDEO_RATES_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_RATES)
15const SORTABLE_BLACKLISTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.BLACKLISTS) 16const SORTABLE_BLACKLISTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.BLACKLISTS)
@@ -33,6 +34,7 @@ const videosSortValidator = checkSort(SORTABLE_VIDEOS_COLUMNS)
33const videoImportsSortValidator = checkSort(SORTABLE_VIDEO_IMPORTS_COLUMNS) 34const videoImportsSortValidator = checkSort(SORTABLE_VIDEO_IMPORTS_COLUMNS)
34const videosSearchSortValidator = checkSort(SORTABLE_VIDEOS_SEARCH_COLUMNS) 35const videosSearchSortValidator = checkSort(SORTABLE_VIDEOS_SEARCH_COLUMNS)
35const videoChannelsSearchSortValidator = checkSort(SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS) 36const videoChannelsSearchSortValidator = checkSort(SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS)
37const videoCommentsValidator = checkSort(SORTABLE_VIDEO_COMMENTS_COLUMNS)
36const videoCommentThreadsSortValidator = checkSort(SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS) 38const videoCommentThreadsSortValidator = checkSort(SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS)
37const videoRatesSortValidator = checkSort(SORTABLE_VIDEO_RATES_COLUMNS) 39const videoRatesSortValidator = checkSort(SORTABLE_VIDEO_RATES_COLUMNS)
38const blacklistSortValidator = checkSort(SORTABLE_BLACKLISTS_COLUMNS) 40const blacklistSortValidator = checkSort(SORTABLE_BLACKLISTS_COLUMNS)
@@ -55,6 +57,7 @@ export {
55 abusesSortValidator, 57 abusesSortValidator,
56 videoChannelsSortValidator, 58 videoChannelsSortValidator,
57 videoImportsSortValidator, 59 videoImportsSortValidator,
60 videoCommentsValidator,
58 videosSearchSortValidator, 61 videosSearchSortValidator,
59 videosSortValidator, 62 videosSortValidator,
60 blacklistSortValidator, 63 blacklistSortValidator,
diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts
index 77f5c6ff3..55fb60b98 100644
--- a/server/middlewares/validators/videos/video-comments.ts
+++ b/server/middlewares/validators/videos/video-comments.ts
@@ -1,8 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator' 2import { body, param, query } from 'express-validator'
3import { MUserAccountUrl } from '@server/types/models' 3import { MUserAccountUrl } from '@server/types/models'
4import { UserRight } from '../../../../shared' 4import { UserRight } from '../../../../shared'
5import { isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc' 5import { exists, isBooleanValid, isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc'
6import { 6import {
7 doesVideoCommentExist, 7 doesVideoCommentExist,
8 doesVideoCommentThreadExist, 8 doesVideoCommentThreadExist,
@@ -15,6 +15,33 @@ import { Hooks } from '../../../lib/plugins/hooks'
15import { MCommentOwnerVideoReply, MVideo, MVideoFullLight } from '../../../types/models/video' 15import { MCommentOwnerVideoReply, MVideo, MVideoFullLight } from '../../../types/models/video'
16import { areValidationErrors } from '../utils' 16import { areValidationErrors } from '../utils'
17 17
18const listVideoCommentsValidator = [
19 query('isLocal')
20 .optional()
21 .custom(isBooleanValid)
22 .withMessage('Should have a valid is local boolean'),
23
24 query('search')
25 .optional()
26 .custom(exists).withMessage('Should have a valid search'),
27
28 query('searchAccount')
29 .optional()
30 .custom(exists).withMessage('Should have a valid account search'),
31
32 query('searchVideo')
33 .optional()
34 .custom(exists).withMessage('Should have a valid video search'),
35
36 (req: express.Request, res: express.Response, next: express.NextFunction) => {
37 logger.debug('Checking listVideoCommentsValidator parameters.', { parameters: req.query })
38
39 if (areValidationErrors(req, res)) return
40
41 return next()
42 }
43]
44
18const listVideoCommentThreadsValidator = [ 45const listVideoCommentThreadsValidator = [
19 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), 46 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
20 47
@@ -116,6 +143,7 @@ export {
116 listVideoCommentThreadsValidator, 143 listVideoCommentThreadsValidator,
117 listVideoThreadCommentsValidator, 144 listVideoThreadCommentsValidator,
118 addVideoCommentThreadValidator, 145 addVideoCommentThreadValidator,
146 listVideoCommentsValidator,
119 addVideoCommentReplyValidator, 147 addVideoCommentReplyValidator,
120 videoCommentGetValidator, 148 videoCommentGetValidator,
121 removeVideoCommentValidator 149 removeVideoCommentValidator
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index de27b3d87..70aed75d6 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -1,6 +1,6 @@
1import * as Bluebird from 'bluebird' 1import * as Bluebird from 'bluebird'
2import { uniq } from 'lodash' 2import { uniq } from 'lodash'
3import { FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize' 3import { FindAndCountOptions, FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'
4import { 4import {
5 AllowNull, 5 AllowNull,
6 BelongsTo, 6 BelongsTo,
@@ -20,13 +20,14 @@ import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'
20import { VideoPrivacy } from '@shared/models' 20import { VideoPrivacy } from '@shared/models'
21import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects' 21import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects'
22import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object' 22import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'
23import { VideoComment } from '../../../shared/models/videos/video-comment.model' 23import { VideoComment, VideoCommentAdmin } from '../../../shared/models/videos/video-comment.model'
24import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor' 24import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor'
25import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 25import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
26import { regexpCapture } from '../../helpers/regexp' 26import { regexpCapture } from '../../helpers/regexp'
27import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants' 27import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
28import { 28import {
29 MComment, 29 MComment,
30 MCommentAdminFormattable,
30 MCommentAP, 31 MCommentAP,
31 MCommentFormattable, 32 MCommentFormattable,
32 MCommentId, 33 MCommentId,
@@ -40,7 +41,14 @@ import {
40import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse' 41import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
41import { AccountModel } from '../account/account' 42import { AccountModel } from '../account/account'
42import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' 43import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
43import { buildBlockedAccountSQL, buildBlockedAccountSQLOptimized, buildLocalAccountIdsIn, getCommentSort, throwIfNotValid } from '../utils' 44import {
45 buildBlockedAccountSQL,
46 buildBlockedAccountSQLOptimized,
47 buildLocalAccountIdsIn,
48 getCommentSort,
49 searchAttribute,
50 throwIfNotValid
51} from '../utils'
44import { VideoModel } from './video' 52import { VideoModel } from './video'
45import { VideoChannelModel } from './video-channel' 53import { VideoChannelModel } from './video-channel'
46 54
@@ -303,6 +311,90 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
303 return VideoCommentModel.scope([ ScopeNames.WITH_IN_REPLY_TO, ScopeNames.WITH_ACCOUNT ]).findOne(query) 311 return VideoCommentModel.scope([ ScopeNames.WITH_IN_REPLY_TO, ScopeNames.WITH_ACCOUNT ]).findOne(query)
304 } 312 }
305 313
314 static listCommentsForApi (parameters: {
315 start: number
316 count: number
317 sort: string
318
319 isLocal?: boolean
320 search?: string
321 searchAccount?: string
322 searchVideo?: string
323 }) {
324 const { start, count, sort, isLocal, search, searchAccount, searchVideo } = parameters
325
326 const query: FindAndCountOptions = {
327 offset: start,
328 limit: count,
329 order: getCommentSort(sort)
330 }
331
332 const where: WhereOptions = {
333 isDeleted: false
334 }
335
336 const whereAccount: WhereOptions = {}
337 const whereActor: WhereOptions = {}
338 const whereVideo: WhereOptions = {}
339
340 if (isLocal === true) {
341 Object.assign(where, {
342 serverId: null
343 })
344 } else if (isLocal === false) {
345 Object.assign(where, {
346 serverId: {
347 [Op.ne]: null
348 }
349 })
350 }
351
352 if (search) {
353 Object.assign(where, searchAttribute(search, 'text'))
354 Object.assign(whereActor, searchAttribute(search, 'preferredUsername'))
355 Object.assign(whereAccount, searchAttribute(search, 'name'))
356 Object.assign(whereVideo, searchAttribute(search, 'name'))
357 }
358
359 if (searchAccount) {
360 Object.assign(whereActor, searchAttribute(search, 'preferredUsername'))
361 Object.assign(whereAccount, searchAttribute(search, 'name'))
362 }
363
364 if (searchVideo) {
365 Object.assign(whereVideo, searchAttribute(search, 'name'))
366 }
367
368 query.include = [
369 {
370 model: AccountModel.unscoped(),
371 required: !!searchAccount,
372 where: whereAccount,
373 include: [
374 {
375 attributes: {
376 exclude: unusedActorAttributesForAPI
377 },
378 model: ActorModel, // Default scope includes avatar and server
379 required: true,
380 where: whereActor
381 }
382 ]
383 },
384 {
385 model: VideoModel.unscoped(),
386 required: true,
387 where: whereVideo
388 }
389 ]
390
391 return VideoCommentModel
392 .findAndCountAll(query)
393 .then(({ rows, count }) => {
394 return { total: count, data: rows }
395 })
396 }
397
306 static async listThreadsForApi (parameters: { 398 static async listThreadsForApi (parameters: {
307 videoId: number 399 videoId: number
308 isVideoOwned: boolean 400 isVideoOwned: boolean
@@ -656,19 +748,51 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
656 id: this.id, 748 id: this.id,
657 url: this.url, 749 url: this.url,
658 text: this.text, 750 text: this.text,
751
659 threadId: this.getThreadId(), 752 threadId: this.getThreadId(),
660 inReplyToCommentId: this.inReplyToCommentId || null, 753 inReplyToCommentId: this.inReplyToCommentId || null,
661 videoId: this.videoId, 754 videoId: this.videoId,
755
662 createdAt: this.createdAt, 756 createdAt: this.createdAt,
663 updatedAt: this.updatedAt, 757 updatedAt: this.updatedAt,
664 deletedAt: this.deletedAt, 758 deletedAt: this.deletedAt,
759
665 isDeleted: this.isDeleted(), 760 isDeleted: this.isDeleted(),
761
666 totalRepliesFromVideoAuthor: this.get('totalRepliesFromVideoAuthor') || 0, 762 totalRepliesFromVideoAuthor: this.get('totalRepliesFromVideoAuthor') || 0,
667 totalReplies: this.get('totalReplies') || 0, 763 totalReplies: this.get('totalReplies') || 0,
668 account: this.Account ? this.Account.toFormattedJSON() : null 764
765 account: this.Account
766 ? this.Account.toFormattedJSON()
767 : null
669 } as VideoComment 768 } as VideoComment
670 } 769 }
671 770
771 toFormattedAdminJSON (this: MCommentAdminFormattable) {
772 return {
773 id: this.id,
774 url: this.url,
775 text: this.text,
776
777 threadId: this.getThreadId(),
778 inReplyToCommentId: this.inReplyToCommentId || null,
779 videoId: this.videoId,
780
781 createdAt: this.createdAt,
782 updatedAt: this.updatedAt,
783
784 video: {
785 id: this.Video.id,
786 uuid: this.Video.uuid,
787 name: this.Video.name
788 },
789
790 account: this.Account
791 ? this.Account.toFormattedJSON()
792 : null
793 } as VideoCommentAdmin
794 }
795
672 toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject { 796 toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject {
673 let inReplyTo: string 797 let inReplyTo: string
674 // New thread, so in AS we reply to the video 798 // New thread, so in AS we reply to the video
diff --git a/server/types/models/video/video-comment.ts b/server/types/models/video/video-comment.ts
index f1c50c753..83479e7b2 100644
--- a/server/types/models/video/video-comment.ts
+++ b/server/types/models/video/video-comment.ts
@@ -1,7 +1,7 @@
1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith, PickWithOpt } from '@shared/core-utils' 1import { PickWith, PickWithOpt } from '@shared/core-utils'
2import { VideoCommentModel } from '../../../models/video/video-comment'
3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account' 3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' 4import { MVideo, MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
5 5
6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> 6type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
7 7
@@ -59,6 +59,11 @@ export type MCommentFormattable =
59 MCommentTotalReplies & 59 MCommentTotalReplies &
60 Use<'Account', MAccountFormattable> 60 Use<'Account', MAccountFormattable>
61 61
62export type MCommentAdminFormattable =
63 MComment &
64 Use<'Account', MAccountFormattable> &
65 Use<'Video', MVideo>
66
62export type MCommentAP = 67export type MCommentAP =
63 MComment & 68 MComment &
64 Use<'Account', MAccountUrl> & 69 Use<'Account', MAccountUrl> &
diff --git a/shared/core-utils/users/user-role.ts b/shared/core-utils/users/user-role.ts
index 2b322faf3..81cba1dad 100644
--- a/shared/core-utils/users/user-role.ts
+++ b/shared/core-utils/users/user-role.ts
@@ -22,7 +22,8 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
22 UserRight.SEE_ALL_VIDEOS, 22 UserRight.SEE_ALL_VIDEOS,
23 UserRight.MANAGE_ACCOUNTS_BLOCKLIST, 23 UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
24 UserRight.MANAGE_SERVERS_BLOCKLIST, 24 UserRight.MANAGE_SERVERS_BLOCKLIST,
25 UserRight.MANAGE_USERS 25 UserRight.MANAGE_USERS,
26 UserRight.SEE_ALL_COMMENTS
26 ], 27 ],
27 28
28 [UserRole.USER]: [] 29 [UserRole.USER]: []
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index e815fa893..bbedc9f00 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -32,6 +32,7 @@ export const enum UserRight {
32 32
33 GET_ANY_LIVE, 33 GET_ANY_LIVE,
34 SEE_ALL_VIDEOS, 34 SEE_ALL_VIDEOS,
35 SEE_ALL_COMMENTS,
35 CHANGE_VIDEO_OWNERSHIP, 36 CHANGE_VIDEO_OWNERSHIP,
36 37
37 MANAGE_PLUGINS, 38 MANAGE_PLUGINS,
diff --git a/shared/models/videos/video-comment.model.ts b/shared/models/videos/video-comment.model.ts
index eec7dba1c..9730a3f76 100644
--- a/shared/models/videos/video-comment.model.ts
+++ b/shared/models/videos/video-comment.model.ts
@@ -16,6 +16,26 @@ export interface VideoComment {
16 account: Account 16 account: Account
17} 17}
18 18
19export interface VideoCommentAdmin {
20 id: number
21 url: string
22 text: string
23
24 threadId: number
25 inReplyToCommentId: number
26
27 createdAt: Date | string
28 updatedAt: Date | string
29
30 account: Account
31
32 video: {
33 id: number
34 uuid: string
35 name: string
36 }
37}
38
19export interface VideoCommentThreadTree { 39export interface VideoCommentThreadTree {
20 comment: VideoComment 40 comment: VideoComment
21 children: VideoCommentThreadTree[] 41 children: VideoCommentThreadTree[]