diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-06-02 20:50:42 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-06-10 21:12:05 +0200 |
commit | 5baee5fca418487e72ddcd6419d31bca8659b668 (patch) | |
tree | 6604cc16d42152f4929d888565d2d435e2480d47 /client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.ts | |
parent | d840487fed32b4604b02030c0d7464afa925904f (diff) | |
download | PeerTube-5baee5fca418487e72ddcd6419d31bca8659b668.tar.gz PeerTube-5baee5fca418487e72ddcd6419d31bca8659b668.tar.zst PeerTube-5baee5fca418487e72ddcd6419d31bca8659b668.zip |
rename blacklist to block/blocklist, merge block and auto-block views
- also replace whitelist with allowlist
- add advanced filters for video-block-list view
- move icons in video-block-list and video-abuse-list to left side
for visibility
- add robot icon to depict automated nature of a block in
video-block-list
resolves #2790
Diffstat (limited to 'client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.ts | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.ts deleted file mode 100644 index fb2962b47..000000000 --- a/client/src/app/+admin/moderation/video-auto-blacklist-list/video-auto-blacklist-list.component.ts +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | import { Component } from '@angular/core' | ||
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
3 | import { ActivatedRoute, Router } from '@angular/router' | ||
4 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | ||
5 | import { AuthService, Notifier, ServerService } from '@app/core' | ||
6 | import { VideoBlacklistService } from '@app/shared' | ||
7 | import { immutableAssign } from '@app/shared/misc/utils' | ||
8 | import { ScreenService } from '@app/shared/misc/screen.service' | ||
9 | import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' | ||
10 | import { SelectionType } from '@app/shared/video/videos-selection.component' | ||
11 | import { Video } from '@app/shared/video/video.model' | ||
12 | |||
13 | @Component({ | ||
14 | selector: 'my-video-auto-blacklist-list', | ||
15 | templateUrl: './video-auto-blacklist-list.component.html', | ||
16 | styleUrls: [ './video-auto-blacklist-list.component.scss' ] | ||
17 | }) | ||
18 | export class VideoAutoBlacklistListComponent { | ||
19 | titlePage: string | ||
20 | selection: SelectionType = {} | ||
21 | miniatureDisplayOptions: MiniatureDisplayOptions = { | ||
22 | date: true, | ||
23 | views: false, | ||
24 | by: true, | ||
25 | privacyLabel: false, | ||
26 | privacyText: true, | ||
27 | state: false, | ||
28 | blacklistInfo: false, | ||
29 | nsfw: true | ||
30 | } | ||
31 | pagination: ComponentPagination = { | ||
32 | currentPage: 1, | ||
33 | itemsPerPage: 5, | ||
34 | totalItems: null | ||
35 | } | ||
36 | videos: Video[] = [] | ||
37 | getVideosObservableFunction = this.getVideosObservable.bind(this) | ||
38 | |||
39 | constructor ( | ||
40 | protected router: Router, | ||
41 | protected route: ActivatedRoute, | ||
42 | protected notifier: Notifier, | ||
43 | protected authService: AuthService, | ||
44 | protected screenService: ScreenService, | ||
45 | protected serverService: ServerService, | ||
46 | private i18n: I18n, | ||
47 | private videoBlacklistService: VideoBlacklistService | ||
48 | ) { | ||
49 | this.titlePage = this.i18n('Auto-blacklisted videos') | ||
50 | } | ||
51 | |||
52 | getVideosObservable (page: number) { | ||
53 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | ||
54 | |||
55 | return this.videoBlacklistService.getAutoBlacklistedAsVideoList(newPagination) | ||
56 | } | ||
57 | |||
58 | removeVideoFromBlacklist (entry: Video) { | ||
59 | this.videoBlacklistService.removeVideoFromBlacklist(entry.id).subscribe( | ||
60 | () => { | ||
61 | this.notifier.success(this.i18n('Video {{name}} removed from blacklist.', { name: entry.name })) | ||
62 | |||
63 | this.videos = this.videos.filter(v => v.id !== entry.id) | ||
64 | }, | ||
65 | |||
66 | error => this.notifier.error(error.message) | ||
67 | ) | ||
68 | } | ||
69 | |||
70 | removeSelectedVideosFromBlacklist () { | ||
71 | const toReleaseVideosIds = Object.keys(this.selection) | ||
72 | .filter(k => this.selection[ k ] === true) | ||
73 | .map(k => parseInt(k, 10)) | ||
74 | |||
75 | this.videoBlacklistService.removeVideoFromBlacklist(toReleaseVideosIds).subscribe( | ||
76 | () => { | ||
77 | this.notifier.success(this.i18n('{{num}} videos removed from blacklist.', { num: toReleaseVideosIds.length })) | ||
78 | |||
79 | this.selection = {} | ||
80 | this.videos = this.videos.filter(v => toReleaseVideosIds.includes(v.id) === false) | ||
81 | }, | ||
82 | |||
83 | error => this.notifier.error(error.message) | ||
84 | ) | ||
85 | } | ||
86 | } | ||