diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-27 11:42:05 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-10-29 11:48:21 +0200 |
commit | 33f6dce136ca6e969fe374efa099bee3f2a3599d (patch) | |
tree | 7a0d6228bab085944015a01267ad31aa1ec6082e /client/src/app/shared/shared-abuse-list | |
parent | 00004f7f6b966a975498612117212b5373f4103c (diff) | |
download | PeerTube-33f6dce136ca6e969fe374efa099bee3f2a3599d.tar.gz PeerTube-33f6dce136ca6e969fe374efa099bee3f2a3599d.tar.zst PeerTube-33f6dce136ca6e969fe374efa099bee3f2a3599d.zip |
Add videos list admin component
Diffstat (limited to 'client/src/app/shared/shared-abuse-list')
5 files changed, 22 insertions, 50 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.html b/client/src/app/shared/shared-abuse-list/abuse-details.component.html index 2f0bc5ae5..a1a4586f0 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-details.component.html +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.html | |||
@@ -85,9 +85,9 @@ | |||
85 | 85 | ||
86 | <!-- report right part (video/comment details) --> | 86 | <!-- report right part (video/comment details) --> |
87 | <div class="right"> | 87 | <div class="right"> |
88 | <div *ngIf="abuse.video" class="screenratio"> | 88 | <div *ngIf="abuse.video"> |
89 | <div *ngIf="abuse.video.deleted" i18n>The video was deleted</div> | 89 | <div *ngIf="abuse.video.deleted" i18n>The video was deleted</div> |
90 | <div *ngIf="!abuse.video.deleted" [innerHTML]="abuse.embedHtml"></div> | 90 | <my-embed *ngIf="!abuse.video.deleted" [video]="abuse.video"></my-embed> |
91 | </div> | 91 | </div> |
92 | 92 | ||
93 | <div *ngIf="abuse.comment" class="comment-html"> | 93 | <div *ngIf="abuse.comment" class="comment-html"> |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html index 4bf83316b..d957eaeab 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.html | |||
@@ -30,9 +30,7 @@ | |||
30 | <ng-template pTemplate="body" let-expanded="expanded" let-abuse> | 30 | <ng-template pTemplate="body" let-expanded="expanded" let-abuse> |
31 | <tr> | 31 | <tr> |
32 | <td class="expand-cell c-hand" [pRowToggler]="abuse" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body"> | 32 | <td class="expand-cell c-hand" [pRowToggler]="abuse" i18n-ngbTooltip ngbTooltip="More information" placement="top-left" container="body"> |
33 | <span class="expander"> | 33 | <my-table-expander-icon [expanded]="expanded"></my-table-expander-icon> |
34 | <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> | ||
35 | </span> | ||
36 | </td> | 34 | </td> |
37 | 35 | ||
38 | <td class="action-cell"> | 36 | <td class="action-cell"> |
@@ -61,28 +59,20 @@ | |||
61 | <ng-container *ngIf="abuse.video"> | 59 | <ng-container *ngIf="abuse.video"> |
62 | 60 | ||
63 | <td *ngIf="!abuse.video.deleted"> | 61 | <td *ngIf="!abuse.video.deleted"> |
64 | <a [href]="getVideoUrl(abuse)" class="table-video-link" [title]="abuse.video.name" target="_blank" rel="noopener noreferrer"> | 62 | <my-video-cell [video]="abuse.video"> |
65 | <div class="table-video"> | 63 | <span image> |
66 | <div class="table-video-image"> | 64 | <span |
67 | <img [src]="abuse.video.thumbnailPath"> | 65 | class="table-video-image-label" *ngIf="abuse.count > 1" |
68 | <span | 66 | i18n-title title="This video has been reported multiple times." |
69 | class="table-video-image-label" *ngIf="abuse.count > 1" | 67 | > |
70 | i18n-title title="This video has been reported multiple times." | 68 | {{ abuse.nth }}/{{ abuse.count }} |
71 | > | 69 | </span> |
72 | {{ abuse.nth }}/{{ abuse.count }} | 70 | </span> |
73 | </span> | 71 | |
74 | </div> | 72 | <span name> |
75 | 73 | <span *ngIf="abuse.video.blacklisted" i18n-title title="The video was blocked" class="glyphicon glyphicon-ban-circle"></span> | |
76 | <div class="table-video-text"> | 74 | </span> |
77 | <div> | 75 | </my-video-cell> |
78 | <span *ngIf="!abuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span> | ||
79 | <span *ngIf="abuse.video.blacklisted" i18n-title title="The video was blocked" class="glyphicon glyphicon-ban-circle"></span> | ||
80 | {{ abuse.video.name }} | ||
81 | </div> | ||
82 | <div i18n>by {{ abuse.video.channel?.displayName }} on {{ abuse.video.channel?.host }} </div> | ||
83 | </div> | ||
84 | </div> | ||
85 | </a> | ||
86 | </td> | 76 | </td> |
87 | 77 | ||
88 | <td *ngIf="abuse.video.deleted" class="c-hand" [pRowToggler]="abuse"> | 78 | <td *ngIf="abuse.video.deleted" class="c-hand" [pRowToggler]="abuse"> |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 297993e39..10f5861b9 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -1,8 +1,6 @@ | |||
1 | import * as debug from 'debug' | 1 | import * as debug from 'debug' |
2 | import truncate from 'lodash-es/truncate' | 2 | import truncate from 'lodash-es/truncate' |
3 | import { SortMeta } from 'primeng/api' | 3 | import { SortMeta } from 'primeng/api' |
4 | import { buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' | ||
5 | import { environment } from 'src/environments/environment' | ||
6 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | 4 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
7 | import { DomSanitizer } from '@angular/platform-browser' | 5 | import { DomSanitizer } from '@angular/platform-browser' |
8 | import { ActivatedRoute, Router } from '@angular/router' | 6 | import { ActivatedRoute, Router } from '@angular/router' |
@@ -10,7 +8,6 @@ import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } | |||
10 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 8 | import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
11 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' | 9 | import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation' |
12 | import { VideoCommentService } from '@app/shared/shared-video-comment' | 10 | import { VideoCommentService } from '@app/shared/shared-video-comment' |
13 | import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils' | ||
14 | import { AbuseState, AdminAbuse } from '@shared/models' | 11 | import { AbuseState, AdminAbuse } from '@shared/models' |
15 | import { AdvancedInputFilter } from '../shared-forms' | 12 | import { AdvancedInputFilter } from '../shared-forms' |
16 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' | 13 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' |
@@ -133,19 +130,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
133 | return '/a/' + abuse.flaggedAccount.nameWithHost | 130 | return '/a/' + abuse.flaggedAccount.nameWithHost |
134 | } | 131 | } |
135 | 132 | ||
136 | getVideoEmbed (abuse: AdminAbuse) { | ||
137 | return buildVideoOrPlaylistEmbed( | ||
138 | decorateVideoLink({ | ||
139 | url: buildVideoEmbedLink(abuse.video, environment.originServerUrl), | ||
140 | title: false, | ||
141 | warningTitle: false, | ||
142 | startTime: abuse.video.startAt, | ||
143 | stopTime: abuse.video.endAt | ||
144 | }), | ||
145 | abuse.video.name | ||
146 | ) | ||
147 | } | ||
148 | |||
149 | async removeAbuse (abuse: AdminAbuse) { | 133 | async removeAbuse (abuse: AdminAbuse) { |
150 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) | 134 | const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`) |
151 | if (res === false) return | 135 | if (res === false) return |
@@ -220,8 +204,6 @@ export class AbuseListTableComponent extends RestTable implements OnInit { | |||
220 | } | 204 | } |
221 | 205 | ||
222 | if (abuse.video) { | 206 | if (abuse.video) { |
223 | abuse.embedHtml = this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)) | ||
224 | |||
225 | if (abuse.video.channel?.ownerAccount) { | 207 | if (abuse.video.channel?.ownerAccount) { |
226 | abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount) | 208 | abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount) |
227 | } | 209 | } |
diff --git a/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts b/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts index 194d52a33..b9a9bd889 100644 --- a/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts +++ b/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts | |||
@@ -1,13 +1,11 @@ | |||
1 | import { SafeHtml } from '@angular/platform-browser' | ||
2 | import { AdminAbuse } from '@shared/models' | ||
3 | import { Account } from '@app/shared/shared-main' | 1 | import { Account } from '@app/shared/shared-main' |
2 | import { AdminAbuse } from '@shared/models' | ||
4 | 3 | ||
5 | // Don't use an abuse model because we need external services to compute some properties | 4 | // Don't use an abuse model because we need external services to compute some properties |
6 | // And this model is only used in this component | 5 | // And this model is only used in this component |
7 | export type ProcessedAbuse = AdminAbuse & { | 6 | export type ProcessedAbuse = AdminAbuse & { |
8 | moderationCommentHtml?: string | 7 | moderationCommentHtml?: string |
9 | reasonHtml?: string | 8 | reasonHtml?: string |
10 | embedHtml?: SafeHtml | ||
11 | updatedAt?: Date | 9 | updatedAt?: Date |
12 | 10 | ||
13 | // override bare server-side definitions with rich client-side definitions | 11 | // override bare server-side definitions with rich client-side definitions |
diff --git a/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts b/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts index 8f3830a17..eeda27fa6 100644 --- a/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts +++ b/client/src/app/shared/shared-abuse-list/shared-abuse-list.module.ts | |||
@@ -1,16 +1,17 @@ | |||
1 | 1 | ||
2 | import { TableModule } from 'primeng/table' | 2 | import { TableModule } from 'primeng/table' |
3 | import { NgModule } from '@angular/core' | 3 | import { NgModule } from '@angular/core' |
4 | import { SharedActorImageModule } from '../shared-actor-image/shared-actor-image.module' | ||
4 | import { SharedFormModule } from '../shared-forms/shared-form.module' | 5 | import { SharedFormModule } from '../shared-forms/shared-form.module' |
5 | import { SharedGlobalIconModule } from '../shared-icons' | 6 | import { SharedGlobalIconModule } from '../shared-icons' |
6 | import { SharedMainModule } from '../shared-main/shared-main.module' | 7 | import { SharedMainModule } from '../shared-main/shared-main.module' |
7 | import { SharedModerationModule } from '../shared-moderation' | 8 | import { SharedModerationModule } from '../shared-moderation' |
9 | import { SharedTablesModule } from '../shared-tables' | ||
8 | import { SharedVideoCommentModule } from '../shared-video-comment' | 10 | import { SharedVideoCommentModule } from '../shared-video-comment' |
9 | import { AbuseDetailsComponent } from './abuse-details.component' | 11 | import { AbuseDetailsComponent } from './abuse-details.component' |
10 | import { AbuseListTableComponent } from './abuse-list-table.component' | 12 | import { AbuseListTableComponent } from './abuse-list-table.component' |
11 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' | 13 | import { AbuseMessageModalComponent } from './abuse-message-modal.component' |
12 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' | 14 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' |
13 | import { SharedActorImageModule } from '../shared-actor-image/shared-actor-image.module' | ||
14 | 15 | ||
15 | @NgModule({ | 16 | @NgModule({ |
16 | imports: [ | 17 | imports: [ |
@@ -21,7 +22,8 @@ import { SharedActorImageModule } from '../shared-actor-image/shared-actor-image | |||
21 | SharedModerationModule, | 22 | SharedModerationModule, |
22 | SharedGlobalIconModule, | 23 | SharedGlobalIconModule, |
23 | SharedVideoCommentModule, | 24 | SharedVideoCommentModule, |
24 | SharedActorImageModule | 25 | SharedActorImageModule, |
26 | SharedTablesModule | ||
25 | ], | 27 | ], |
26 | 28 | ||
27 | declarations: [ | 29 | declarations: [ |