]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Regroup abuse and blacklisted videos inside "moderation"
authorChocobozzz <me@florianbigard.com>
Tue, 14 Aug 2018 14:38:37 +0000 (16:38 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 14 Aug 2018 16:01:22 +0000 (18:01 +0200)
25 files changed:
client/src/app/+admin/admin-routing.module.ts
client/src/app/+admin/admin.component.html
client/src/app/+admin/admin.module.ts
client/src/app/+admin/moderation/index.ts [new file with mode: 0644]
client/src/app/+admin/moderation/moderation.component.html [new file with mode: 0644]
client/src/app/+admin/moderation/moderation.component.scss [new file with mode: 0644]
client/src/app/+admin/moderation/moderation.component.ts [new file with mode: 0644]
client/src/app/+admin/moderation/moderation.routes.ts [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/index.ts [moved from client/src/app/+admin/video-abuses/video-abuse-list/index.ts with 100% similarity]
client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html [moved from client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.html with 100% similarity]
client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.scss [moved from client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.scss with 100% similarity]
client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts [moved from client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts with 95% similarity]
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html [moved from client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html with 95% similarity]
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss [moved from client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss with 58% similarity]
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts [moved from client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts with 93% similarity]
client/src/app/+admin/moderation/video-blacklist-list/index.ts [moved from client/src/app/+admin/video-blacklist/video-blacklist-list/index.ts with 100% similarity]
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html [moved from client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html with 93% similarity]
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss [moved from client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss with 58% similarity]
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts [moved from client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts with 94% similarity]
client/src/app/+admin/video-abuses/index.ts [deleted file]
client/src/app/+admin/video-abuses/video-abuses.component.ts [deleted file]
client/src/app/+admin/video-abuses/video-abuses.routes.ts [deleted file]
client/src/app/+admin/video-blacklist/index.ts [deleted file]
client/src/app/+admin/video-blacklist/video-blacklist.component.ts [deleted file]
client/src/app/+admin/video-blacklist/video-blacklist.routes.ts [deleted file]

index 0301d760184e1f48738489f99f81176784f5bf15..ca31ba585d3ef3436b95f1834f57e998c6831081 100644 (file)
@@ -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
     ]
index 1b2b89c3ad12b25bd7febe6f4b4c6a6d0c37b1fe..345fb9f5a18385212e352927f54612e14866105a 100644 (file)
@@ -8,12 +8,8 @@
       Manage follows
     </a>
 
-    <a i18n *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active" class="title-page">
-      Video abuses
-    </a>
-
-    <a i18n *ngIf="hasVideoBlacklistRight()" routerLink="/admin/video-blacklist" routerLinkActive="active" class="title-page">
-      Video blacklist
+    <a i18n *ngIf="hasVideoAbusesRight() || hasVideoBlacklistRight()" routerLink="/admin/moderation" routerLinkActive="active" class="title-page">
+      Moderation
     </a>
 
     <a i18n *ngIf="hasJobsRight()" routerLink="/admin/jobs" routerLinkActive="active" class="title-page">
index 23ca5a6b3a13bfaaf62dd3fb715922a78e261a3d..e94aac1ebc2fa355f203e6381fe7f6cf26843f71 100644 (file)
@@ -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 (file)
index 0000000..66e2c6a
--- /dev/null
@@ -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 (file)
index 0000000..91e87fc
--- /dev/null
@@ -0,0 +1,11 @@
+<div class="admin-sub-header">
+  <div i18n class="form-sub-title">Moderation</div>
+
+  <div class="admin-sub-nav">
+    <a *ngIf="hasVideoAbusesRight()" i18n routerLink="video-abuses/list" routerLinkActive="active">Video abuses</a>
+
+    <a *ngIf="hasVideoBlacklistRight()" i18n routerLink="video-blacklist/list" routerLinkActive="active">Blacklisted videos</a>
+  </div>
+</div>
+
+<router-outlet></router-outlet>
\ 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 (file)
index 0000000..766d785
--- /dev/null
@@ -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 (file)
index 0000000..0f4efb9
--- /dev/null
@@ -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 (file)
index 0000000..b133152
--- /dev/null
@@ -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'
+          }
+        }
+      }
+    ]
+  }
+]
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 7e8af6e5a872e9d7d170231af7c49ed2c08c23c6..34ab384d134792afa5fb2db47f9d5194f540134a 100644 (file)
@@ -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({
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 f213ab4b08f8fe57ae50165bc4b070cea5367026..722ff79063788352463b54f774cb845ce552d6f1 100644 (file)
@@ -1,7 +1,3 @@
-<div class="admin-sub-header">
-  <div i18n class="form-sub-title">Video abuses list</div>
-</div>
-
 <p-table
   [value]="videoAbuses" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
similarity index 58%
rename from client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss
rename to client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss
index 951a3fc92d9af9f5264d5af3ad8e12a3d67468c1..2391fef8f97c466a752efed92e19f1567bfa5d09 100644 (file)
@@ -1,5 +1,5 @@
-@import '_variables';
-@import '_mixins';
+@import 'variables';
+@import 'mixins';
 
 .moderation-comment-label {
   font-weight: $font-semibold;
similarity index 93%
rename from client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
rename to client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts
index 377e9c80f25d8ef700181d8d0e1c50a0c4fe767b..b17278b941bf38ab8c9fa14d82d10a83132f4b84 100644 (file)
@@ -1,14 +1,14 @@
 import { Component, OnInit, ViewChild } from '@angular/core'
-import { Account } from '@app/shared/account/account.model'
+import { Account } from '../../../shared/account/account.model'
 import { NotificationsService } from 'angular2-notifications'
 import { SortMeta } from 'primeng/components/common/sortmeta'
 import { VideoAbuse, VideoAbuseState } from '../../../../../../shared'
 import { RestPagination, RestTable, VideoAbuseService } from '../../../shared'
 import { I18n } from '@ngx-translate/i18n-polyfill'
-import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
-import { ConfirmService } from '@app/core'
+import { DropdownAction } from '../../../shared/buttons/action-dropdown.component'
+import { ConfirmService } from '../../../core/index'
 import { ModerationCommentModalComponent } from './moderation-comment-modal.component'
-import { Video } from '@app/shared/video/video.model'
+import { Video } from '../../../shared/video/video.model'
 
 @Component({
   selector: 'my-video-abuse-list',
similarity index 93%
rename from client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html
rename to client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html
index 05b3a300c1133f2884107eaa55a090c8f77b95f4..dafaeb1e2fd112be8063a52d6f264c7e45f49dc4 100644 (file)
@@ -1,7 +1,3 @@
-<div class="admin-sub-header">
-  <div i18n class="form-sub-title">Blacklisted videos</div>
-</div>
-
 <p-table
   [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
@@ -41,7 +37,7 @@
 
   <ng-template pTemplate="rowexpansion" let-videoBlacklist>
     <tr class="blacklist-reason">
-      <td colspan="6">
+      <td colspan="7">
         <span i18n class="blacklist-reason-label">Blacklist reason:</span>
         {{ videoBlacklist.reason }}
       </td>
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 0618252b8ca76021a81048c1e2e97a0ef8a37686..9890d1f90928228fe9dc83e27b2d6c1f3a548e7c 100644 (file)
@@ -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 (file)
index 395fac2..0000000
+++ /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 (file)
index 9dae5c0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-import { Component } from '@angular/core'
-
-@Component({
-  template: '<router-outlet></router-outlet>'
-})
-
-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 (file)
index 68b7560..0000000
+++ /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 (file)
index a5451e2..0000000
+++ /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 (file)
index 24b8c98..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-import { Component } from '@angular/core'
-
-@Component({
-  template: '<router-outlet></router-outlet>'
-})
-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 (file)
index b1e0e50..0000000
+++ /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'
-          }
-        }
-      }
-    ]
-  }
-]