From 614d1ae928ec307b708c4a3eb423797353b1df2a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Aug 2018 16:38:37 +0200 Subject: [PATCH] Regroup abuse and blacklisted videos inside "moderation" --- client/src/app/+admin/admin-routing.module.ts | 6 +-- client/src/app/+admin/admin.component.html | 8 +--- client/src/app/+admin/admin.module.ts | 8 ++-- client/src/app/+admin/moderation/index.ts | 4 ++ .../moderation/moderation.component.html | 11 +++++ .../moderation/moderation.component.scss | 4 ++ .../+admin/moderation/moderation.component.ts | 19 +++++++++ .../+admin/moderation/moderation.routes.ts | 42 +++++++++++++++++++ .../video-abuse-list/index.ts | 0 .../moderation-comment-modal.component.html | 0 .../moderation-comment-modal.component.scss | 0 .../moderation-comment-modal.component.ts | 2 +- .../video-abuse-list.component.html | 4 -- .../video-abuse-list.component.scss | 4 +- .../video-abuse-list.component.ts | 8 ++-- .../video-blacklist-list/index.ts | 0 .../video-blacklist-list.component.html | 6 +-- .../video-blacklist-list.component.scss | 4 +- .../video-blacklist-list.component.ts | 4 +- client/src/app/+admin/video-abuses/index.ts | 3 -- .../video-abuses/video-abuses.component.ts | 8 ---- .../video-abuses/video-abuses.routes.ts | 33 --------------- .../src/app/+admin/video-blacklist/index.ts | 3 -- .../video-blacklist.component.ts | 7 ---- .../video-blacklist/video-blacklist.routes.ts | 33 --------------- 25 files changed, 99 insertions(+), 122 deletions(-) create mode 100644 client/src/app/+admin/moderation/index.ts create mode 100644 client/src/app/+admin/moderation/moderation.component.html create mode 100644 client/src/app/+admin/moderation/moderation.component.scss create mode 100644 client/src/app/+admin/moderation/moderation.component.ts create mode 100644 client/src/app/+admin/moderation/moderation.routes.ts rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/index.ts (100%) rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/moderation-comment-modal.component.html (100%) rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/moderation-comment-modal.component.scss (100%) rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/moderation-comment-modal.component.ts (95%) rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/video-abuse-list.component.html (95%) rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/video-abuse-list.component.scss (58%) rename client/src/app/+admin/{video-abuses => moderation}/video-abuse-list/video-abuse-list.component.ts (93%) rename client/src/app/+admin/{video-blacklist => moderation}/video-blacklist-list/index.ts (100%) rename client/src/app/+admin/{video-blacklist => moderation}/video-blacklist-list/video-blacklist-list.component.html (93%) rename client/src/app/+admin/{video-blacklist => moderation}/video-blacklist-list/video-blacklist-list.component.scss (58%) rename client/src/app/+admin/{video-blacklist => moderation}/video-blacklist-list/video-blacklist-list.component.ts (94%) delete mode 100644 client/src/app/+admin/video-abuses/index.ts delete mode 100644 client/src/app/+admin/video-abuses/video-abuses.component.ts delete mode 100644 client/src/app/+admin/video-abuses/video-abuses.routes.ts delete mode 100644 client/src/app/+admin/video-blacklist/index.ts delete mode 100644 client/src/app/+admin/video-blacklist/video-blacklist.component.ts delete mode 100644 client/src/app/+admin/video-blacklist/video-blacklist.routes.ts diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts index 0301d7601..ca31ba585 100644 --- a/client/src/app/+admin/admin-routing.module.ts +++ b/client/src/app/+admin/admin-routing.module.ts @@ -8,8 +8,7 @@ import { AdminComponent } from './admin.component' import { FollowsRoutes } from './follows' import { JobsRoutes } from './jobs/job.routes' import { UsersRoutes } from './users' -import { VideoAbusesRoutes } from './video-abuses' -import { VideoBlacklistRoutes } from './video-blacklist' +import { ModerationRoutes } from '@app/+admin/moderation/moderation.routes' const adminRoutes: Routes = [ { @@ -25,8 +24,7 @@ const adminRoutes: Routes = [ }, ...FollowsRoutes, ...UsersRoutes, - ...VideoAbusesRoutes, - ...VideoBlacklistRoutes, + ...ModerationRoutes, ...JobsRoutes, ...ConfigRoutes ] diff --git a/client/src/app/+admin/admin.component.html b/client/src/app/+admin/admin.component.html index 1b2b89c3a..345fb9f5a 100644 --- a/client/src/app/+admin/admin.component.html +++ b/client/src/app/+admin/admin.component.html @@ -8,12 +8,8 @@ Manage follows - - Video abuses - - - - Video blacklist + + Moderation diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index 23ca5a6b3..e94aac1eb 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts @@ -11,9 +11,9 @@ import { JobsComponent } from './jobs/job.component' import { JobsListComponent } from './jobs/jobs-list/jobs-list.component' import { JobService } from './jobs/shared/job.service' import { UserCreateComponent, UserListComponent, UsersComponent, UserService, UserUpdateComponent } from './users' -import { ModerationCommentModalComponent, VideoAbuseListComponent, VideoAbusesComponent } from './video-abuses' -import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist' +import { ModerationCommentModalComponent, VideoAbuseListComponent, VideoBlacklistListComponent } from './moderation' import { UserBanModalComponent } from '@app/+admin/users/user-list/user-ban-modal.component' +import { ModerationComponent } from '@app/+admin/moderation/moderation.component' @NgModule({ imports: [ @@ -36,10 +36,8 @@ import { UserBanModalComponent } from '@app/+admin/users/user-list/user-ban-moda UserListComponent, UserBanModalComponent, - VideoBlacklistComponent, + ModerationComponent, VideoBlacklistListComponent, - - VideoAbusesComponent, VideoAbuseListComponent, ModerationCommentModalComponent, diff --git a/client/src/app/+admin/moderation/index.ts b/client/src/app/+admin/moderation/index.ts new file mode 100644 index 000000000..66e2c6a39 --- /dev/null +++ b/client/src/app/+admin/moderation/index.ts @@ -0,0 +1,4 @@ +export * from './video-abuse-list' +export * from './video-blacklist-list' +export * from './moderation.component' +export * from './moderation.routes' diff --git a/client/src/app/+admin/moderation/moderation.component.html b/client/src/app/+admin/moderation/moderation.component.html new file mode 100644 index 000000000..91e87fcd4 --- /dev/null +++ b/client/src/app/+admin/moderation/moderation.component.html @@ -0,0 +1,11 @@ +
+
Moderation
+ +
+
+ + \ No newline at end of file diff --git a/client/src/app/+admin/moderation/moderation.component.scss b/client/src/app/+admin/moderation/moderation.component.scss new file mode 100644 index 000000000..766d7853b --- /dev/null +++ b/client/src/app/+admin/moderation/moderation.component.scss @@ -0,0 +1,4 @@ +.form-sub-title { + flex-grow: 0; + margin-right: 30px; +} diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts new file mode 100644 index 000000000..0f4efb970 --- /dev/null +++ b/client/src/app/+admin/moderation/moderation.component.ts @@ -0,0 +1,19 @@ +import { Component } from '@angular/core' +import { UserRight } from '../../../../../shared' +import { AuthService } from '@app/core/auth/auth.service' + +@Component({ + templateUrl: './moderation.component.html', + styleUrls: [ './moderation.component.scss' ] +}) +export class ModerationComponent { + constructor (private auth: AuthService) {} + + hasVideoAbusesRight () { + return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_ABUSES) + } + + hasVideoBlacklistRight () { + return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) + } +} diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.ts new file mode 100644 index 000000000..b133152d9 --- /dev/null +++ b/client/src/app/+admin/moderation/moderation.routes.ts @@ -0,0 +1,42 @@ +import { Routes } from '@angular/router' +import { UserRight } from '../../../../../shared' +import { UserRightGuard } from '@app/core' +import { VideoAbuseListComponent } from '@app/+admin/moderation/video-abuse-list' +import { VideoBlacklistListComponent } from '@app/+admin/moderation/video-blacklist-list' +import { ModerationComponent } from '@app/+admin/moderation/moderation.component' + +export const ModerationRoutes: Routes = [ + { + path: 'moderation', + component: ModerationComponent, + children: [ + { + path: '', + redirectTo: 'video-abuses/list', + pathMatch: 'full' + }, + { + path: 'video-abuses/list', + component: VideoAbuseListComponent, + canActivate: [ UserRightGuard ], + data: { + userRight: UserRight.MANAGE_VIDEO_ABUSES, + meta: { + title: 'Video abuses list' + } + } + }, + { + path: 'video-blacklist/list', + component: VideoBlacklistListComponent, + canActivate: [ UserRightGuard ], + data: { + userRight: UserRight.MANAGE_VIDEO_BLACKLIST, + meta: { + title: 'Blacklisted videos' + } + } + } + ] + } +] diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/index.ts b/client/src/app/+admin/moderation/video-abuse-list/index.ts similarity index 100% rename from client/src/app/+admin/video-abuses/video-abuse-list/index.ts rename to client/src/app/+admin/moderation/video-abuse-list/index.ts diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.html b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html similarity index 100% rename from client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.html rename to client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.scss b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.scss similarity index 100% rename from client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.scss rename to client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.scss diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts similarity index 95% rename from client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts rename to client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts index 7e8af6e5a..34ab384d1 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts @@ -4,7 +4,7 @@ import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '.. import { I18n } from '@ngx-translate/i18n-polyfill' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { FormValidatorService } from '../../../shared/forms/form-validators/form-validator.service' import { VideoAbuse } from '../../../../../../shared/models/videos' @Component({ diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html similarity index 95% rename from client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html rename to client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index f213ab4b0..722ff7906 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -1,7 +1,3 @@ -
-
Video abuses list
-
- -
Blacklisted videos
- - - + Blacklist reason: {{ videoBlacklist.reason }} diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss similarity index 58% rename from client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss rename to client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss index 5265536ca..063f6324e 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss @@ -1,5 +1,5 @@ -@import '_variables'; -@import '_mixins'; +@import 'variables'; +@import 'mixins'; .blacklist-reason-label { font-weight: $font-semibold; diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts similarity index 94% rename from client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts rename to client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index 0618252b8..9890d1f90 100644 --- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -5,8 +5,8 @@ import { ConfirmService } from '../../../core' import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' import { VideoBlacklist } from '../../../../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' -import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' -import { Video } from '@app/shared/video/video.model' +import { DropdownAction } from '../../../shared/buttons/action-dropdown.component' +import { Video } from '../../../shared/video/video.model' @Component({ selector: 'my-video-blacklist-list', diff --git a/client/src/app/+admin/video-abuses/index.ts b/client/src/app/+admin/video-abuses/index.ts deleted file mode 100644 index 395fac2e7..000000000 --- a/client/src/app/+admin/video-abuses/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './video-abuse-list' -export * from './video-abuses.component' -export * from './video-abuses.routes' diff --git a/client/src/app/+admin/video-abuses/video-abuses.component.ts b/client/src/app/+admin/video-abuses/video-abuses.component.ts deleted file mode 100644 index 9dae5c0b6..000000000 --- a/client/src/app/+admin/video-abuses/video-abuses.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from '@angular/core' - -@Component({ - template: '' -}) - -export class VideoAbusesComponent { -} diff --git a/client/src/app/+admin/video-abuses/video-abuses.routes.ts b/client/src/app/+admin/video-abuses/video-abuses.routes.ts deleted file mode 100644 index 68b756059..000000000 --- a/client/src/app/+admin/video-abuses/video-abuses.routes.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Routes } from '@angular/router' - -import { UserRightGuard } from '../../core' -import { UserRight } from '../../../../../shared' -import { VideoAbusesComponent } from './video-abuses.component' -import { VideoAbuseListComponent } from './video-abuse-list' - -export const VideoAbusesRoutes: Routes = [ - { - path: 'video-abuses', - component: VideoAbusesComponent, - canActivate: [ UserRightGuard ], - data: { - userRight: UserRight.MANAGE_VIDEO_ABUSES - }, - children: [ - { - path: '', - redirectTo: 'list', - pathMatch: 'full' - }, - { - path: 'list', - component: VideoAbuseListComponent, - data: { - meta: { - title: 'Video abuses list' - } - } - } - ] - } -] diff --git a/client/src/app/+admin/video-blacklist/index.ts b/client/src/app/+admin/video-blacklist/index.ts deleted file mode 100644 index a5451e2e1..000000000 --- a/client/src/app/+admin/video-blacklist/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './video-blacklist-list' -export * from './video-blacklist.component' -export * from './video-blacklist.routes' diff --git a/client/src/app/+admin/video-blacklist/video-blacklist.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist.component.ts deleted file mode 100644 index 24b8c98f8..000000000 --- a/client/src/app/+admin/video-blacklist/video-blacklist.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core' - -@Component({ - template: '' -}) -export class VideoBlacklistComponent { -} diff --git a/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts b/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts deleted file mode 100644 index b1e0e5049..000000000 --- a/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Routes } from '@angular/router' - -import { UserRightGuard } from '../../core' -import { UserRight } from '../../../../../shared' -import { VideoBlacklistComponent } from './video-blacklist.component' -import { VideoBlacklistListComponent } from './video-blacklist-list' - -export const VideoBlacklistRoutes: Routes = [ - { - path: 'video-blacklist', - component: VideoBlacklistComponent, - canActivate: [ UserRightGuard ], - data: { - userRight: UserRight.MANAGE_VIDEO_BLACKLIST - }, - children: [ - { - path: '', - redirectTo: 'list', - pathMatch: 'full' - }, - { - path: 'list', - component: VideoBlacklistListComponent, - data: { - meta: { - title: 'Blacklisted videos' - } - } - } - ] - } -]