diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-03 14:33:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-03 16:42:15 +0200 |
commit | 2e46eb97154da909b82d5efe1d336a3412594ff0 (patch) | |
tree | a86b6ca6439f62c8498887c4e1c3ece9a302d116 /client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |
parent | 514e8168fbad08e70ce12dab587f720b4e91b19e (diff) | |
download | PeerTube-2e46eb97154da909b82d5efe1d336a3412594ff0.tar.gz PeerTube-2e46eb97154da909b82d5efe1d336a3412594ff0.tar.zst PeerTube-2e46eb97154da909b82d5efe1d336a3412594ff0.zip |
Refactor search filters
Diffstat (limited to 'client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index dfd8dc745..498d8321a 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -2,9 +2,9 @@ import { SortMeta } from 'primeng/api' | |||
2 | import { switchMap } from 'rxjs/operators' | 2 | import { switchMap } from 'rxjs/operators' |
3 | import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' | 3 | import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' |
4 | import { environment } from 'src/environments/environment' | 4 | import { environment } from 'src/environments/environment' |
5 | import { AfterViewInit, Component, OnInit } from '@angular/core' | 5 | import { Component, OnInit } from '@angular/core' |
6 | import { DomSanitizer } from '@angular/platform-browser' | 6 | import { DomSanitizer } from '@angular/platform-browser' |
7 | import { ActivatedRoute, Params, Router } from '@angular/router' | 7 | import { ActivatedRoute, Router } from '@angular/router' |
8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
9 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 9 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
10 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 10 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
@@ -16,7 +16,7 @@ import { VideoBlacklist, VideoBlacklistType } from '@shared/models' | |||
16 | templateUrl: './video-block-list.component.html', | 16 | templateUrl: './video-block-list.component.html', |
17 | styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-block-list.component.scss' ] | 17 | styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-block-list.component.scss' ] |
18 | }) | 18 | }) |
19 | export class VideoBlockListComponent extends RestTable implements OnInit, AfterViewInit { | 19 | export class VideoBlockListComponent extends RestTable implements OnInit { |
20 | blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] | 20 | blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] |
21 | totalRecords = 0 | 21 | totalRecords = 0 |
22 | sort: SortMeta = { field: 'createdAt', order: -1 } | 22 | sort: SortMeta = { field: 'createdAt', order: -1 } |
@@ -64,7 +64,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
64 | ).subscribe( | 64 | ).subscribe( |
65 | () => { | 65 | () => { |
66 | this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) | 66 | this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) |
67 | this.loadData() | 67 | this.reloadData() |
68 | }, | 68 | }, |
69 | 69 | ||
70 | err => this.notifier.error(err.message) | 70 | err => this.notifier.error(err.message) |
@@ -116,11 +116,6 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
116 | }) | 116 | }) |
117 | 117 | ||
118 | this.initialize() | 118 | this.initialize() |
119 | this.listenToSearchChange() | ||
120 | } | ||
121 | |||
122 | ngAfterViewInit () { | ||
123 | if (this.search) this.setTableFilter(this.search, false) | ||
124 | } | 119 | } |
125 | 120 | ||
126 | getIdentifier () { | 121 | getIdentifier () { |
@@ -144,7 +139,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
144 | this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( | 139 | this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( |
145 | () => { | 140 | () => { |
146 | this.notifier.success($localize`Video ${entry.video.name} unblocked.`) | 141 | this.notifier.success($localize`Video ${entry.video.name} unblocked.`) |
147 | this.loadData() | 142 | this.reloadData() |
148 | }, | 143 | }, |
149 | 144 | ||
150 | err => this.notifier.error(err.message) | 145 | err => this.notifier.error(err.message) |
@@ -162,7 +157,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
162 | ) | 157 | ) |
163 | } | 158 | } |
164 | 159 | ||
165 | protected loadData () { | 160 | protected reloadData () { |
166 | this.videoBlocklistService.listBlocks({ | 161 | this.videoBlocklistService.listBlocks({ |
167 | pagination: this.pagination, | 162 | pagination: this.pagination, |
168 | sort: this.sort, | 163 | sort: this.sort, |