Regroup abuse and blacklisted videos inside "moderation"

pull/925/head
Chocobozzz 2018-08-14 16:38:37 +02:00
parent 65b247ddc7
commit 614d1ae928
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
25 changed files with 99 additions and 122 deletions

View 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
]

View 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">

View 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,

View File

@ -0,0 +1,4 @@
export * from './video-abuse-list'
export * from './video-blacklist-list'
export * from './moderation.component'
export * from './moderation.routes'

View File

@ -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>

View File

@ -0,0 +1,4 @@
.form-sub-title {
flex-grow: 0;
margin-right: 30px;
}

View File

@ -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)
}
}

View File

@ -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'
}
}
}
]
}
]

View 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({

View 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"

View File

@ -1,5 +1,5 @@
@import '_variables';
@import '_mixins';
@import 'variables';
@import 'mixins';
.moderation-comment-label {
font-weight: $font-semibold;

View 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',

View 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>

View File

@ -1,5 +1,5 @@
@import '_variables';
@import '_mixins';
@import 'variables';
@import 'mixins';
.blacklist-reason-label {
font-weight: $font-semibold;

View 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',

View File

@ -1,3 +0,0 @@
export * from './video-abuse-list'
export * from './video-abuses.component'
export * from './video-abuses.routes'

View File

@ -1,8 +0,0 @@
import { Component } from '@angular/core'
@Component({
template: '<router-outlet></router-outlet>'
})
export class VideoAbusesComponent {
}

View File

@ -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'
}
}
}
]
}
]

View File

@ -1,3 +0,0 @@
export * from './video-blacklist-list'
export * from './video-blacklist.component'
export * from './video-blacklist.routes'

View File

@ -1,7 +0,0 @@
import { Component } from '@angular/core'
@Component({
template: '<router-outlet></router-outlet>'
})
export class VideoBlacklistComponent {
}

View File

@ -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'
}
}
}
]
}
]