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)
36 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 [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.scss [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss [new file with mode: 0644]
client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts [new file with mode: 0644]
client/src/app/+admin/moderation/video-blacklist-list/index.ts [new file with mode: 0644]
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html [new file with mode: 0644]
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss [new file with mode: 0644]
client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts [new file with mode: 0644]
client/src/app/+admin/video-abuses/index.ts [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/index.ts [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.html [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.scss [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss [deleted file]
client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.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-list/index.ts [deleted file]
client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html [deleted file]
client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss [deleted file]
client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.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'
+          }
+        }
+      }
+    ]
+  }
+]
diff --git a/client/src/app/+admin/moderation/video-abuse-list/index.ts b/client/src/app/+admin/moderation/video-abuse-list/index.ts
new file mode 100644 (file)
index 0000000..da7176e
--- /dev/null
@@ -0,0 +1,2 @@
+export * from './video-abuse-list.component'
+export * from './moderation-comment-modal.component'
diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html
new file mode 100644 (file)
index 0000000..3a8424f
--- /dev/null
@@ -0,0 +1,32 @@
+<ng-template #modal>
+  <div class="modal-header">
+    <h4 i18n class="modal-title">Moderation comment</h4>
+    <span class="close" aria-hidden="true" (click)="hideModerationCommentModal()"></span>
+  </div>
+
+  <div class="modal-body">
+    <form novalidate [formGroup]="form" (ngSubmit)="banUser()">
+      <div class="form-group">
+        <textarea formControlName="moderationComment" [ngClass]="{ 'input-error': formErrors['moderationComment'] }">
+        </textarea>
+        <div *ngIf="formErrors.moderationComment" class="form-error">
+          {{ formErrors.moderationComment }}
+        </div>
+      </div>
+
+      <div i18n>
+        This comment can only be seen by you or the other moderators.
+      </div>
+
+      <div class="form-group inputs">
+        <span i18n class="action-button action-button-cancel" (click)="hideModerationCommentModal()">Cancel</span>
+
+        <input
+          type="submit" i18n-value value="Update this comment" class="action-button-submit"
+          [disabled]="!form.valid"
+        >
+      </div>
+    </form>
+  </div>
+
+</ng-template>
\ No newline at end of file
diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.scss b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.scss
new file mode 100644 (file)
index 0000000..afcdb9a
--- /dev/null
@@ -0,0 +1,6 @@
+@import 'variables';
+@import 'mixins';
+
+textarea {
+  @include peertube-textarea(100%, 100px);
+}
diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts
new file mode 100644 (file)
index 0000000..34ab384
--- /dev/null
@@ -0,0 +1,73 @@
+import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
+import { NotificationsService } from 'angular2-notifications'
+import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '../../../shared'
+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 '../../../shared/forms/form-validators/form-validator.service'
+import { VideoAbuse } from '../../../../../../shared/models/videos'
+
+@Component({
+  selector: 'my-moderation-comment-modal',
+  templateUrl: './moderation-comment-modal.component.html',
+  styleUrls: [ './moderation-comment-modal.component.scss' ]
+})
+export class ModerationCommentModalComponent extends FormReactive implements OnInit {
+  @ViewChild('modal') modal: NgbModal
+  @Output() commentUpdated = new EventEmitter<string>()
+
+  private abuseToComment: VideoAbuse
+  private openedModal: NgbModalRef
+
+  constructor (
+    protected formValidatorService: FormValidatorService,
+    private modalService: NgbModal,
+    private notificationsService: NotificationsService,
+    private videoAbuseService: VideoAbuseService,
+    private videoAbuseValidatorsService: VideoAbuseValidatorsService,
+    private i18n: I18n
+  ) {
+    super()
+  }
+
+  ngOnInit () {
+    this.buildForm({
+      moderationComment: this.videoAbuseValidatorsService.VIDEO_ABUSE_REASON
+    })
+  }
+
+  openModal (abuseToComment: VideoAbuse) {
+    this.abuseToComment = abuseToComment
+    this.openedModal = this.modalService.open(this.modal)
+
+    this.form.patchValue({
+      moderationComment: this.abuseToComment.moderationComment
+    })
+  }
+
+  hideModerationCommentModal () {
+    this.abuseToComment = undefined
+    this.openedModal.close()
+    this.form.reset()
+  }
+
+  async banUser () {
+    const moderationComment: string = this.form.value['moderationComment']
+
+    this.videoAbuseService.updateVideoAbuse(this.abuseToComment, { moderationComment })
+      .subscribe(
+        () => {
+          this.notificationsService.success(
+            this.i18n('Success'),
+            this.i18n('Comment updated.')
+          )
+
+          this.commentUpdated.emit(moderationComment)
+          this.hideModerationCommentModal()
+        },
+
+          err => this.notificationsService.error(this.i18n('Error'), err.message)
+      )
+  }
+
+}
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
new file mode 100644 (file)
index 0000000..722ff79
--- /dev/null
@@ -0,0 +1,62 @@
+<p-table
+  [value]="videoAbuses" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
+  [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
+>
+  <ng-template pTemplate="header">
+    <tr>
+      <th style="width: 40px"></th>
+      <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th>
+      <th i18n>Reason</th>
+      <th i18n>Reporter</th>
+      <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
+      <th i18n>Video</th>
+      <th style="width: 50px;"></th>
+    </tr>
+  </ng-template>
+
+  <ng-template pTemplate="body" let-expanded="expanded" let-videoAbuse>
+    <tr>
+      <td>
+        <span *ngIf="videoAbuse.moderationComment" class="expander" [pRowToggler]="videoAbuse">
+          <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
+        </span>
+      </td>
+
+      <td>
+        <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span>
+        <span *ngIf="isVideoAbuseRejected(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-remove"></span>
+      </td>
+
+      <td>{{ videoAbuse.reason }}</td>
+
+      <td>
+        <a [href]="videoAbuse.reporterAccount.url" i18n-title title="Go to the account" target="_blank" rel="noopener noreferrer">
+          {{ createByString(videoAbuse.reporterAccount) }}
+        </a>
+      </td>
+
+      <td>{{ videoAbuse.createdAt }}</td>
+
+      <td>
+        <a [href]="getVideoUrl(videoAbuse)" i18n-title title="Go to the video" target="_blank" rel="noopener noreferrer">
+          {{ videoAbuse.video.name }}
+        </a>
+      </td>
+
+      <td class="action-cell">
+        <my-action-dropdown i18n-label label="Actions" [actions]="videoAbuseActions" [entry]="videoAbuse"></my-action-dropdown>
+      </td>
+    </tr>
+  </ng-template>
+
+  <ng-template pTemplate="rowexpansion" let-videoAbuse>
+    <tr class="moderation-comment">
+      <td colspan="7">
+        <span i18n class="moderation-comment-label">Moderation comment:</span>
+        {{ videoAbuse.moderationComment }}
+      </td>
+    </tr>
+  </ng-template>
+</p-table>
+
+<my-moderation-comment-modal #moderationCommentModal (commentUpdated)="onModerationCommentUpdated()"></my-moderation-comment-modal>
\ No newline at end of file
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss
new file mode 100644 (file)
index 0000000..2391fef
--- /dev/null
@@ -0,0 +1,6 @@
+@import 'variables';
+@import 'mixins';
+
+.moderation-comment-label {
+  font-weight: $font-semibold;
+}
\ No newline at end of file
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts
new file mode 100644 (file)
index 0000000..b17278b
--- /dev/null
@@ -0,0 +1,125 @@
+import { Component, OnInit, ViewChild } from '@angular/core'
+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 '../../../shared/buttons/action-dropdown.component'
+import { ConfirmService } from '../../../core/index'
+import { ModerationCommentModalComponent } from './moderation-comment-modal.component'
+import { Video } from '../../../shared/video/video.model'
+
+@Component({
+  selector: 'my-video-abuse-list',
+  templateUrl: './video-abuse-list.component.html',
+  styleUrls: [ './video-abuse-list.component.scss']
+})
+export class VideoAbuseListComponent extends RestTable implements OnInit {
+  @ViewChild('moderationCommentModal') moderationCommentModal: ModerationCommentModalComponent
+
+  videoAbuses: VideoAbuse[] = []
+  totalRecords = 0
+  rowsPerPage = 10
+  sort: SortMeta = { field: 'createdAt', order: 1 }
+  pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
+
+  videoAbuseActions: DropdownAction<VideoAbuse>[] = []
+
+  constructor (
+    private notificationsService: NotificationsService,
+    private videoAbuseService: VideoAbuseService,
+    private confirmService: ConfirmService,
+    private i18n: I18n
+  ) {
+    super()
+
+    this.videoAbuseActions = [
+      {
+        label: this.i18n('Delete'),
+        handler: videoAbuse => this.removeVideoAbuse(videoAbuse)
+      },
+      {
+        label: this.i18n('Update moderation comment'),
+        handler: videoAbuse => this.openModerationCommentModal(videoAbuse)
+      },
+      {
+        label: this.i18n('Mark as accepted'),
+        handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED),
+        isDisplayed: videoAbuse => !this.isVideoAbuseAccepted(videoAbuse)
+      },
+      {
+        label: this.i18n('Mark as rejected'),
+        handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.REJECTED),
+        isDisplayed: videoAbuse => !this.isVideoAbuseRejected(videoAbuse)
+      }
+    ]
+  }
+
+  ngOnInit () {
+    this.loadSort()
+  }
+
+  openModerationCommentModal (videoAbuse: VideoAbuse) {
+    this.moderationCommentModal.openModal(videoAbuse)
+  }
+
+  onModerationCommentUpdated () {
+    this.loadData()
+  }
+
+  createByString (account: Account) {
+    return Account.CREATE_BY_STRING(account.name, account.host)
+  }
+
+  isVideoAbuseAccepted (videoAbuse: VideoAbuse) {
+    return videoAbuse.state.id === VideoAbuseState.ACCEPTED
+  }
+
+  isVideoAbuseRejected (videoAbuse: VideoAbuse) {
+    return videoAbuse.state.id === VideoAbuseState.REJECTED
+  }
+
+  getVideoUrl (videoAbuse: VideoAbuse) {
+    return Video.buildClientUrl(videoAbuse.video.uuid)
+  }
+
+  async removeVideoAbuse (videoAbuse: VideoAbuse) {
+    const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse?'), this.i18n('Delete'))
+    if (res === false) return
+
+    this.videoAbuseService.removeVideoAbuse(videoAbuse).subscribe(
+      () => {
+        this.notificationsService.success(
+          this.i18n('Success'),
+          this.i18n('Abuse deleted.')
+        )
+        this.loadData()
+      },
+
+      err => this.notificationsService.error(this.i18n('Error'), err.message)
+    )
+  }
+
+  updateVideoAbuseState (videoAbuse: VideoAbuse, state: VideoAbuseState) {
+    this.videoAbuseService.updateVideoAbuse(videoAbuse, { state })
+      .subscribe(
+        () => this.loadData(),
+
+        err => this.notificationsService.error(this.i18n('Error'), err.message)
+      )
+
+  }
+
+  protected loadData () {
+    return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort)
+               .subscribe(
+                 resultList => {
+                   this.videoAbuses = resultList.data
+                   this.totalRecords = resultList.total
+                 },
+
+                 err => this.notificationsService.error(this.i18n('Error'), err.message)
+               )
+  }
+}
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/index.ts b/client/src/app/+admin/moderation/video-blacklist-list/index.ts
new file mode 100644 (file)
index 0000000..4daf641
--- /dev/null
@@ -0,0 +1 @@
+export * from './video-blacklist-list.component'
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html
new file mode 100644 (file)
index 0000000..dafaeb1
--- /dev/null
@@ -0,0 +1,47 @@
+<p-table
+  [value]="blacklist" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
+  [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id"
+>
+  <ng-template pTemplate="header">
+    <tr>
+      <th style="width: 40px"></th>
+      <th i18n pSortableColumn="name">Video name <p-sortIcon field="name"></p-sortIcon></th>
+      <th i18n>Sensitive</th>
+      <th i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th>
+      <th style="width: 50px;"></th>
+    </tr>
+  </ng-template>
+
+  <ng-template pTemplate="body" let-videoBlacklist let-expanded="expanded">
+    <tr>
+      <td>
+        <span *ngIf="videoBlacklist.reason" class="expander" [pRowToggler]="videoBlacklist">
+          <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
+        </span>
+      </td>
+
+      <td>
+        <a [href]="getVideoUrl(videoBlacklist)" i18n-title title="Go to the video" target="_blank" rel="noopener noreferrer">
+          {{ videoBlacklist.video.name }}
+        </a>
+      </td>
+
+      <td>{{ videoBlacklist.video.nsfw }}</td>
+      <td>{{ videoBlacklist.createdAt }}</td>
+
+      <td class="action-cell">
+        <my-action-dropdown i18n-label label="Actions" [actions]="videoBlacklistActions" [entry]="videoBlacklist"></my-action-dropdown>
+      </td>
+    </tr>
+  </ng-template>
+
+  <ng-template pTemplate="rowexpansion" let-videoBlacklist>
+    <tr class="blacklist-reason">
+      <td colspan="7">
+        <span i18n class="blacklist-reason-label">Blacklist reason:</span>
+        {{ videoBlacklist.reason }}
+      </td>
+    </tr>
+  </ng-template>
+</p-table>
+
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.scss
new file mode 100644 (file)
index 0000000..063f632
--- /dev/null
@@ -0,0 +1,6 @@
+@import 'variables';
+@import 'mixins';
+
+.blacklist-reason-label {
+  font-weight: $font-semibold;
+}
\ No newline at end of file
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts
new file mode 100644 (file)
index 0000000..9890d1f
--- /dev/null
@@ -0,0 +1,81 @@
+import { Component, OnInit } from '@angular/core'
+import { SortMeta } from 'primeng/components/common/sortmeta'
+import { NotificationsService } from 'angular2-notifications'
+import { ConfirmService } from '../../../core'
+import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared'
+import { VideoBlacklist } from '../../../../../../shared'
+import { I18n } from '@ngx-translate/i18n-polyfill'
+import { DropdownAction } from '../../../shared/buttons/action-dropdown.component'
+import { Video } from '../../../shared/video/video.model'
+
+@Component({
+  selector: 'my-video-blacklist-list',
+  templateUrl: './video-blacklist-list.component.html',
+  styleUrls: [ './video-blacklist-list.component.scss' ]
+})
+export class VideoBlacklistListComponent extends RestTable implements OnInit {
+  blacklist: VideoBlacklist[] = []
+  totalRecords = 0
+  rowsPerPage = 10
+  sort: SortMeta = { field: 'createdAt', order: 1 }
+  pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
+
+  videoBlacklistActions: DropdownAction<VideoBlacklist>[] = []
+
+  constructor (
+    private notificationsService: NotificationsService,
+    private confirmService: ConfirmService,
+    private videoBlacklistService: VideoBlacklistService,
+    private i18n: I18n
+  ) {
+    super()
+
+    this.videoBlacklistActions = [
+      {
+        label: this.i18n('Unblacklist'),
+        handler: videoBlacklist => this.removeVideoFromBlacklist(videoBlacklist)
+      }
+    ]
+  }
+
+  ngOnInit () {
+    this.loadSort()
+  }
+
+  getVideoUrl (videoBlacklist: VideoBlacklist) {
+    return Video.buildClientUrl(videoBlacklist.video.uuid)
+  }
+
+  async removeVideoFromBlacklist (entry: VideoBlacklist) {
+    const confirmMessage = this.i18n(
+      'Do you really want to remove this video from the blacklist? It will be available again in the videos list.'
+    )
+
+    const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist'))
+    if (res === false) return
+
+    this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe(
+      () => {
+        this.notificationsService.success(
+          this.i18n('Success'),
+          this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name })
+        )
+        this.loadData()
+      },
+
+      err => this.notificationsService.error(this.i18n('Error'), err.message)
+    )
+  }
+
+  protected loadData () {
+    this.videoBlacklistService.listBlacklist(this.pagination, this.sort)
+      .subscribe(
+        resultList => {
+          this.blacklist = resultList.data
+          this.totalRecords = resultList.total
+        },
+
+        err => this.notificationsService.error(this.i18n('Error'), err.message)
+      )
+  }
+}
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-abuse-list/index.ts b/client/src/app/+admin/video-abuses/video-abuse-list/index.ts
deleted file mode 100644 (file)
index da7176e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './video-abuse-list.component'
-export * from './moderation-comment-modal.component'
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.html b/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.html
deleted file mode 100644 (file)
index 3a8424f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<ng-template #modal>
-  <div class="modal-header">
-    <h4 i18n class="modal-title">Moderation comment</h4>
-    <span class="close" aria-hidden="true" (click)="hideModerationCommentModal()"></span>
-  </div>
-
-  <div class="modal-body">
-    <form novalidate [formGroup]="form" (ngSubmit)="banUser()">
-      <div class="form-group">
-        <textarea formControlName="moderationComment" [ngClass]="{ 'input-error': formErrors['moderationComment'] }">
-        </textarea>
-        <div *ngIf="formErrors.moderationComment" class="form-error">
-          {{ formErrors.moderationComment }}
-        </div>
-      </div>
-
-      <div i18n>
-        This comment can only be seen by you or the other moderators.
-      </div>
-
-      <div class="form-group inputs">
-        <span i18n class="action-button action-button-cancel" (click)="hideModerationCommentModal()">Cancel</span>
-
-        <input
-          type="submit" i18n-value value="Update this comment" class="action-button-submit"
-          [disabled]="!form.valid"
-        >
-      </div>
-    </form>
-  </div>
-
-</ng-template>
\ No newline at end of file
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.scss b/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.scss
deleted file mode 100644 (file)
index afcdb9a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-@import 'variables';
-@import 'mixins';
-
-textarea {
-  @include peertube-textarea(100%, 100px);
-}
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/video-abuses/video-abuse-list/moderation-comment-modal.component.ts
deleted file mode 100644 (file)
index 7e8af6e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
-import { NotificationsService } from 'angular2-notifications'
-import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '../../../shared'
-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 { VideoAbuse } from '../../../../../../shared/models/videos'
-
-@Component({
-  selector: 'my-moderation-comment-modal',
-  templateUrl: './moderation-comment-modal.component.html',
-  styleUrls: [ './moderation-comment-modal.component.scss' ]
-})
-export class ModerationCommentModalComponent extends FormReactive implements OnInit {
-  @ViewChild('modal') modal: NgbModal
-  @Output() commentUpdated = new EventEmitter<string>()
-
-  private abuseToComment: VideoAbuse
-  private openedModal: NgbModalRef
-
-  constructor (
-    protected formValidatorService: FormValidatorService,
-    private modalService: NgbModal,
-    private notificationsService: NotificationsService,
-    private videoAbuseService: VideoAbuseService,
-    private videoAbuseValidatorsService: VideoAbuseValidatorsService,
-    private i18n: I18n
-  ) {
-    super()
-  }
-
-  ngOnInit () {
-    this.buildForm({
-      moderationComment: this.videoAbuseValidatorsService.VIDEO_ABUSE_REASON
-    })
-  }
-
-  openModal (abuseToComment: VideoAbuse) {
-    this.abuseToComment = abuseToComment
-    this.openedModal = this.modalService.open(this.modal)
-
-    this.form.patchValue({
-      moderationComment: this.abuseToComment.moderationComment
-    })
-  }
-
-  hideModerationCommentModal () {
-    this.abuseToComment = undefined
-    this.openedModal.close()
-    this.form.reset()
-  }
-
-  async banUser () {
-    const moderationComment: string = this.form.value['moderationComment']
-
-    this.videoAbuseService.updateVideoAbuse(this.abuseToComment, { moderationComment })
-      .subscribe(
-        () => {
-          this.notificationsService.success(
-            this.i18n('Success'),
-            this.i18n('Comment updated.')
-          )
-
-          this.commentUpdated.emit(moderationComment)
-          this.hideModerationCommentModal()
-        },
-
-          err => this.notificationsService.error(this.i18n('Error'), err.message)
-      )
-  }
-
-}
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.html
deleted file mode 100644 (file)
index f213ab4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<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"
->
-  <ng-template pTemplate="header">
-    <tr>
-      <th style="width: 40px"></th>
-      <th i18n pSortableColumn="state" style="width: 80px;">State <p-sortIcon field="state"></p-sortIcon></th>
-      <th i18n>Reason</th>
-      <th i18n>Reporter</th>
-      <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
-      <th i18n>Video</th>
-      <th style="width: 50px;"></th>
-    </tr>
-  </ng-template>
-
-  <ng-template pTemplate="body" let-expanded="expanded" let-videoAbuse>
-    <tr>
-      <td>
-        <span *ngIf="videoAbuse.moderationComment" class="expander" [pRowToggler]="videoAbuse">
-          <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
-        </span>
-      </td>
-
-      <td>
-        <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span>
-        <span *ngIf="isVideoAbuseRejected(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-remove"></span>
-      </td>
-
-      <td>{{ videoAbuse.reason }}</td>
-
-      <td>
-        <a [href]="videoAbuse.reporterAccount.url" i18n-title title="Go to the account" target="_blank" rel="noopener noreferrer">
-          {{ createByString(videoAbuse.reporterAccount) }}
-        </a>
-      </td>
-
-      <td>{{ videoAbuse.createdAt }}</td>
-
-      <td>
-        <a [href]="getVideoUrl(videoAbuse)" i18n-title title="Go to the video" target="_blank" rel="noopener noreferrer">
-          {{ videoAbuse.video.name }}
-        </a>
-      </td>
-
-      <td class="action-cell">
-        <my-action-dropdown i18n-label label="Actions" [actions]="videoAbuseActions" [entry]="videoAbuse"></my-action-dropdown>
-      </td>
-    </tr>
-  </ng-template>
-
-  <ng-template pTemplate="rowexpansion" let-videoAbuse>
-    <tr class="moderation-comment">
-      <td colspan="7">
-        <span i18n class="moderation-comment-label">Moderation comment:</span>
-        {{ videoAbuse.moderationComment }}
-      </td>
-    </tr>
-  </ng-template>
-</p-table>
-
-<my-moderation-comment-modal #moderationCommentModal (commentUpdated)="onModerationCommentUpdated()"></my-moderation-comment-modal>
\ No newline at end of file
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss
deleted file mode 100644 (file)
index 951a3fc..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-@import '_variables';
-@import '_mixins';
-
-.moderation-comment-label {
-  font-weight: $font-semibold;
-}
\ No newline at end of file
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
deleted file mode 100644 (file)
index 377e9c8..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-import { Component, OnInit, ViewChild } from '@angular/core'
-import { Account } from '@app/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 { ModerationCommentModalComponent } from './moderation-comment-modal.component'
-import { Video } from '@app/shared/video/video.model'
-
-@Component({
-  selector: 'my-video-abuse-list',
-  templateUrl: './video-abuse-list.component.html',
-  styleUrls: [ './video-abuse-list.component.scss']
-})
-export class VideoAbuseListComponent extends RestTable implements OnInit {
-  @ViewChild('moderationCommentModal') moderationCommentModal: ModerationCommentModalComponent
-
-  videoAbuses: VideoAbuse[] = []
-  totalRecords = 0
-  rowsPerPage = 10
-  sort: SortMeta = { field: 'createdAt', order: 1 }
-  pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
-
-  videoAbuseActions: DropdownAction<VideoAbuse>[] = []
-
-  constructor (
-    private notificationsService: NotificationsService,
-    private videoAbuseService: VideoAbuseService,
-    private confirmService: ConfirmService,
-    private i18n: I18n
-  ) {
-    super()
-
-    this.videoAbuseActions = [
-      {
-        label: this.i18n('Delete'),
-        handler: videoAbuse => this.removeVideoAbuse(videoAbuse)
-      },
-      {
-        label: this.i18n('Update moderation comment'),
-        handler: videoAbuse => this.openModerationCommentModal(videoAbuse)
-      },
-      {
-        label: this.i18n('Mark as accepted'),
-        handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED),
-        isDisplayed: videoAbuse => !this.isVideoAbuseAccepted(videoAbuse)
-      },
-      {
-        label: this.i18n('Mark as rejected'),
-        handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.REJECTED),
-        isDisplayed: videoAbuse => !this.isVideoAbuseRejected(videoAbuse)
-      }
-    ]
-  }
-
-  ngOnInit () {
-    this.loadSort()
-  }
-
-  openModerationCommentModal (videoAbuse: VideoAbuse) {
-    this.moderationCommentModal.openModal(videoAbuse)
-  }
-
-  onModerationCommentUpdated () {
-    this.loadData()
-  }
-
-  createByString (account: Account) {
-    return Account.CREATE_BY_STRING(account.name, account.host)
-  }
-
-  isVideoAbuseAccepted (videoAbuse: VideoAbuse) {
-    return videoAbuse.state.id === VideoAbuseState.ACCEPTED
-  }
-
-  isVideoAbuseRejected (videoAbuse: VideoAbuse) {
-    return videoAbuse.state.id === VideoAbuseState.REJECTED
-  }
-
-  getVideoUrl (videoAbuse: VideoAbuse) {
-    return Video.buildClientUrl(videoAbuse.video.uuid)
-  }
-
-  async removeVideoAbuse (videoAbuse: VideoAbuse) {
-    const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse?'), this.i18n('Delete'))
-    if (res === false) return
-
-    this.videoAbuseService.removeVideoAbuse(videoAbuse).subscribe(
-      () => {
-        this.notificationsService.success(
-          this.i18n('Success'),
-          this.i18n('Abuse deleted.')
-        )
-        this.loadData()
-      },
-
-      err => this.notificationsService.error(this.i18n('Error'), err.message)
-    )
-  }
-
-  updateVideoAbuseState (videoAbuse: VideoAbuse, state: VideoAbuseState) {
-    this.videoAbuseService.updateVideoAbuse(videoAbuse, { state })
-      .subscribe(
-        () => this.loadData(),
-
-        err => this.notificationsService.error(this.i18n('Error'), err.message)
-      )
-
-  }
-
-  protected loadData () {
-    return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort)
-               .subscribe(
-                 resultList => {
-                   this.videoAbuses = resultList.data
-                   this.totalRecords = resultList.total
-                 },
-
-                 err => this.notificationsService.error(this.i18n('Error'), err.message)
-               )
-  }
-}
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-list/index.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/index.ts
deleted file mode 100644 (file)
index 4daf641..0000000
+++ /dev/null
@@ -1 +0,0 @@
-export * from './video-blacklist-list.component'
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html
deleted file mode 100644 (file)
index 05b3a30..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<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"
->
-  <ng-template pTemplate="header">
-    <tr>
-      <th style="width: 40px"></th>
-      <th i18n pSortableColumn="name">Video name <p-sortIcon field="name"></p-sortIcon></th>
-      <th i18n>Sensitive</th>
-      <th i18n pSortableColumn="createdAt">Date <p-sortIcon field="createdAt"></p-sortIcon></th>
-      <th style="width: 50px;"></th>
-    </tr>
-  </ng-template>
-
-  <ng-template pTemplate="body" let-videoBlacklist let-expanded="expanded">
-    <tr>
-      <td>
-        <span *ngIf="videoBlacklist.reason" class="expander" [pRowToggler]="videoBlacklist">
-          <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
-        </span>
-      </td>
-
-      <td>
-        <a [href]="getVideoUrl(videoBlacklist)" i18n-title title="Go to the video" target="_blank" rel="noopener noreferrer">
-          {{ videoBlacklist.video.name }}
-        </a>
-      </td>
-
-      <td>{{ videoBlacklist.video.nsfw }}</td>
-      <td>{{ videoBlacklist.createdAt }}</td>
-
-      <td class="action-cell">
-        <my-action-dropdown i18n-label label="Actions" [actions]="videoBlacklistActions" [entry]="videoBlacklist"></my-action-dropdown>
-      </td>
-    </tr>
-  </ng-template>
-
-  <ng-template pTemplate="rowexpansion" let-videoBlacklist>
-    <tr class="blacklist-reason">
-      <td colspan="6">
-        <span i18n class="blacklist-reason-label">Blacklist reason:</span>
-        {{ videoBlacklist.reason }}
-      </td>
-    </tr>
-  </ng-template>
-</p-table>
-
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.scss
deleted file mode 100644 (file)
index 5265536..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-@import '_variables';
-@import '_mixins';
-
-.blacklist-reason-label {
-  font-weight: $font-semibold;
-}
\ No newline at end of file
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts
deleted file mode 100644 (file)
index 0618252..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-import { Component, OnInit } from '@angular/core'
-import { SortMeta } from 'primeng/components/common/sortmeta'
-import { NotificationsService } from 'angular2-notifications'
-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'
-
-@Component({
-  selector: 'my-video-blacklist-list',
-  templateUrl: './video-blacklist-list.component.html',
-  styleUrls: [ './video-blacklist-list.component.scss' ]
-})
-export class VideoBlacklistListComponent extends RestTable implements OnInit {
-  blacklist: VideoBlacklist[] = []
-  totalRecords = 0
-  rowsPerPage = 10
-  sort: SortMeta = { field: 'createdAt', order: 1 }
-  pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
-
-  videoBlacklistActions: DropdownAction<VideoBlacklist>[] = []
-
-  constructor (
-    private notificationsService: NotificationsService,
-    private confirmService: ConfirmService,
-    private videoBlacklistService: VideoBlacklistService,
-    private i18n: I18n
-  ) {
-    super()
-
-    this.videoBlacklistActions = [
-      {
-        label: this.i18n('Unblacklist'),
-        handler: videoBlacklist => this.removeVideoFromBlacklist(videoBlacklist)
-      }
-    ]
-  }
-
-  ngOnInit () {
-    this.loadSort()
-  }
-
-  getVideoUrl (videoBlacklist: VideoBlacklist) {
-    return Video.buildClientUrl(videoBlacklist.video.uuid)
-  }
-
-  async removeVideoFromBlacklist (entry: VideoBlacklist) {
-    const confirmMessage = this.i18n(
-      'Do you really want to remove this video from the blacklist? It will be available again in the videos list.'
-    )
-
-    const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist'))
-    if (res === false) return
-
-    this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe(
-      () => {
-        this.notificationsService.success(
-          this.i18n('Success'),
-          this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name })
-        )
-        this.loadData()
-      },
-
-      err => this.notificationsService.error(this.i18n('Error'), err.message)
-    )
-  }
-
-  protected loadData () {
-    this.videoBlacklistService.listBlacklist(this.pagination, this.sort)
-      .subscribe(
-        resultList => {
-          this.blacklist = resultList.data
-          this.totalRecords = resultList.total
-        },
-
-        err => this.notificationsService.error(this.i18n('Error'), err.message)
-      )
-  }
-}
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'
-          }
-        }
-      }
-    ]
-  }
-]