diff options
Diffstat (limited to 'client')
21 files changed, 78 insertions, 79 deletions
diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts index 0cd3e54c2..c3e4895ac 100644 --- a/client/src/app/+admin/admin-routing.module.ts +++ b/client/src/app/+admin/admin-routing.module.ts | |||
@@ -9,7 +9,7 @@ import { RequestSchedulersRoutes } from './request-schedulers' | |||
9 | import { UsersRoutes } from './users' | 9 | import { UsersRoutes } from './users' |
10 | import { VideoAbusesRoutes } from './video-abuses' | 10 | import { VideoAbusesRoutes } from './video-abuses' |
11 | import { AdminGuard } from './admin-guard.service' | 11 | import { AdminGuard } from './admin-guard.service' |
12 | import { BlacklistRoutes } from './blacklist' | 12 | import { VideoBlacklistRoutes } from './video-blacklist' |
13 | 13 | ||
14 | const adminRoutes: Routes = [ | 14 | const adminRoutes: Routes = [ |
15 | { | 15 | { |
@@ -27,7 +27,7 @@ const adminRoutes: Routes = [ | |||
27 | ...RequestSchedulersRoutes, | 27 | ...RequestSchedulersRoutes, |
28 | ...UsersRoutes, | 28 | ...UsersRoutes, |
29 | ...VideoAbusesRoutes, | 29 | ...VideoAbusesRoutes, |
30 | ...BlacklistRoutes | 30 | ...VideoBlacklistRoutes |
31 | ] | 31 | ] |
32 | } | 32 | } |
33 | ] | 33 | ] |
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts index 93ec216bf..ecd62ee61 100644 --- a/client/src/app/+admin/admin.component.ts +++ b/client/src/app/+admin/admin.component.ts | |||
@@ -3,6 +3,5 @@ import { Component } from '@angular/core' | |||
3 | @Component({ | 3 | @Component({ |
4 | template: '<router-outlet></router-outlet>' | 4 | template: '<router-outlet></router-outlet>' |
5 | }) | 5 | }) |
6 | |||
7 | export class AdminComponent { | 6 | export class AdminComponent { |
8 | } | 7 | } |
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index c2dd60774..f29c501b0 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts | |||
@@ -6,7 +6,7 @@ import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendServic | |||
6 | import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers' | 6 | import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers' |
7 | import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users' | 7 | import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users' |
8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' | 8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' |
9 | import { BlacklistComponent, BlacklistListComponent, BlacklistService } from './blacklist' | 9 | import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist' |
10 | import { SharedModule } from '../shared' | 10 | import { SharedModule } from '../shared' |
11 | import { AdminGuard } from './admin-guard.service' | 11 | import { AdminGuard } from './admin-guard.service' |
12 | 12 | ||
@@ -31,8 +31,8 @@ import { AdminGuard } from './admin-guard.service' | |||
31 | UserUpdateComponent, | 31 | UserUpdateComponent, |
32 | UserListComponent, | 32 | UserListComponent, |
33 | 33 | ||
34 | BlacklistComponent, | 34 | VideoBlacklistComponent, |
35 | BlacklistListComponent, | 35 | VideoBlacklistListComponent, |
36 | 36 | ||
37 | VideoAbusesComponent, | 37 | VideoAbusesComponent, |
38 | VideoAbuseListComponent | 38 | VideoAbuseListComponent |
@@ -46,8 +46,7 @@ import { AdminGuard } from './admin-guard.service' | |||
46 | FriendService, | 46 | FriendService, |
47 | RequestSchedulersService, | 47 | RequestSchedulersService, |
48 | UserService, | 48 | UserService, |
49 | AdminGuard, | 49 | AdminGuard |
50 | BlacklistService | ||
51 | ] | 50 | ] |
52 | }) | 51 | }) |
53 | export class AdminModule { } | 52 | export class AdminModule { } |
diff --git a/client/src/app/+admin/blacklist/blacklist-list/index.ts b/client/src/app/+admin/blacklist/blacklist-list/index.ts deleted file mode 100644 index 45f60a2b9..000000000 --- a/client/src/app/+admin/blacklist/blacklist-list/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './blacklist-list.component' | ||
diff --git a/client/src/app/+admin/blacklist/blacklist.routes.ts b/client/src/app/+admin/blacklist/blacklist.routes.ts deleted file mode 100644 index 780347ca8..000000000 --- a/client/src/app/+admin/blacklist/blacklist.routes.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { Routes } from '@angular/router' | ||
2 | |||
3 | import { BlacklistComponent } from './blacklist.component' | ||
4 | import { BlacklistListComponent } from './blacklist-list' | ||
5 | |||
6 | export const BlacklistRoutes: Routes = [ | ||
7 | { | ||
8 | path: 'blacklist', | ||
9 | component: BlacklistComponent, | ||
10 | children: [ | ||
11 | { | ||
12 | path: '', | ||
13 | redirectTo: 'list', | ||
14 | pathMatch: 'full' | ||
15 | }, | ||
16 | { | ||
17 | path: 'list', | ||
18 | component: BlacklistListComponent, | ||
19 | data: { | ||
20 | meta: { | ||
21 | title: 'Blacklisted videos' | ||
22 | } | ||
23 | } | ||
24 | } | ||
25 | ] | ||
26 | } | ||
27 | ] | ||
diff --git a/client/src/app/+admin/blacklist/index.ts b/client/src/app/+admin/blacklist/index.ts deleted file mode 100644 index 675dc1263..000000000 --- a/client/src/app/+admin/blacklist/index.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export * from './shared' | ||
2 | export * from './blacklist-list' | ||
3 | export * from './blacklist.component' | ||
4 | export * from './blacklist.routes' | ||
diff --git a/client/src/app/+admin/blacklist/shared/index.ts b/client/src/app/+admin/blacklist/shared/index.ts deleted file mode 100644 index ad22e2d51..000000000 --- a/client/src/app/+admin/blacklist/shared/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './blacklist.service' | ||
diff --git a/client/src/app/+admin/video-blacklist/index.ts b/client/src/app/+admin/video-blacklist/index.ts new file mode 100644 index 000000000..a5451e2e1 --- /dev/null +++ b/client/src/app/+admin/video-blacklist/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-blacklist-list' | ||
2 | export * from './video-blacklist.component' | ||
3 | 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 new file mode 100644 index 000000000..4daf64187 --- /dev/null +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './video-blacklist-list.component' | |||
diff --git a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html index 5d4636ee9..05d116798 100644 --- a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.html +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.html | |||
@@ -18,8 +18,8 @@ | |||
18 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> | 18 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> |
19 | <p-column header="Delete" styleClass="action-cell"> | 19 | <p-column header="Delete" styleClass="action-cell"> |
20 | <ng-template pTemplate="body" let-entry="rowData"> | 20 | <ng-template pTemplate="body" let-entry="rowData"> |
21 | <span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video"></span> | 21 | <span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video from blacklist"></span> |
22 | </ng-template> | 22 | </ng-template> |
23 | </p-column> | 23 | </p-column> |
24 | </p-dataTable> | 24 | </p-dataTable> |
25 | </div> | 25 | </div> |
diff --git a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts index b308054ed..56024b247 100644 --- a/client/src/app/+admin/blacklist/blacklist-list/blacklist-list.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts | |||
@@ -4,16 +4,15 @@ import { SortMeta } from 'primeng/components/common/sortmeta' | |||
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
5 | 5 | ||
6 | import { ConfirmService } from '../../../core' | 6 | import { ConfirmService } from '../../../core' |
7 | import { RestTable, RestPagination } from '../../../shared' | 7 | import { VideoBlacklistService, RestTable, RestPagination } from '../../../shared' |
8 | import { BlacklistService } from '../shared' | ||
9 | import { BlacklistedVideo } from '../../../../../../shared' | 8 | import { BlacklistedVideo } from '../../../../../../shared' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
12 | selector: 'my-blacklist-list', | 11 | selector: 'my-video-blacklist-list', |
13 | templateUrl: './blacklist-list.component.html', | 12 | templateUrl: './video-blacklist-list.component.html', |
14 | styleUrls: [] | 13 | styleUrls: [] |
15 | }) | 14 | }) |
16 | export class BlacklistListComponent extends RestTable implements OnInit { | 15 | export class VideoBlacklistListComponent extends RestTable implements OnInit { |
17 | blacklist: BlacklistedVideo[] = [] | 16 | blacklist: BlacklistedVideo[] = [] |
18 | totalRecords = 0 | 17 | totalRecords = 0 |
19 | rowsPerPage = 10 | 18 | rowsPerPage = 10 |
@@ -23,7 +22,7 @@ export class BlacklistListComponent extends RestTable implements OnInit { | |||
23 | constructor ( | 22 | constructor ( |
24 | private notificationsService: NotificationsService, | 23 | private notificationsService: NotificationsService, |
25 | private confirmService: ConfirmService, | 24 | private confirmService: ConfirmService, |
26 | private blacklistService: BlacklistService | 25 | private videoBlacklistService: VideoBlacklistService |
27 | ) { | 26 | ) { |
28 | super() | 27 | super() |
29 | } | 28 | } |
@@ -39,7 +38,7 @@ export class BlacklistListComponent extends RestTable implements OnInit { | |||
39 | res => { | 38 | res => { |
40 | if (res === false) return | 39 | if (res === false) return |
41 | 40 | ||
42 | this.blacklistService.removeVideoFromBlacklist(entry).subscribe( | 41 | this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( |
43 | status => { | 42 | status => { |
44 | this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`) | 43 | this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`) |
45 | this.loadData() | 44 | this.loadData() |
@@ -52,7 +51,7 @@ export class BlacklistListComponent extends RestTable implements OnInit { | |||
52 | } | 51 | } |
53 | 52 | ||
54 | protected loadData () { | 53 | protected loadData () { |
55 | this.blacklistService.getBlacklist(this.pagination, this.sort) | 54 | this.videoBlacklistService.listBlacklist(this.pagination, this.sort) |
56 | .subscribe( | 55 | .subscribe( |
57 | resultList => { | 56 | resultList => { |
58 | this.blacklist = resultList.data | 57 | this.blacklist = resultList.data |
diff --git a/client/src/app/+admin/blacklist/blacklist.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist.component.ts index ce8fe4298..24b8c98f8 100644 --- a/client/src/app/+admin/blacklist/blacklist.component.ts +++ b/client/src/app/+admin/video-blacklist/video-blacklist.component.ts | |||
@@ -3,6 +3,5 @@ import { Component } from '@angular/core' | |||
3 | @Component({ | 3 | @Component({ |
4 | template: '<router-outlet></router-outlet>' | 4 | template: '<router-outlet></router-outlet>' |
5 | }) | 5 | }) |
6 | 6 | export class VideoBlacklistComponent { | |
7 | export class BlacklistComponent { | ||
8 | } | 7 | } |
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts b/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts new file mode 100644 index 000000000..682b6f8bd --- /dev/null +++ b/client/src/app/+admin/video-blacklist/video-blacklist.routes.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | import { Routes } from '@angular/router' | ||
2 | |||
3 | import { VideoBlacklistComponent } from './video-blacklist.component' | ||
4 | import { VideoBlacklistListComponent } from './video-blacklist-list' | ||
5 | |||
6 | export const VideoBlacklistRoutes: Routes = [ | ||
7 | { | ||
8 | path: 'video-blacklist', | ||
9 | component: VideoBlacklistComponent, | ||
10 | children: [ | ||
11 | { | ||
12 | path: '', | ||
13 | redirectTo: 'list', | ||
14 | pathMatch: 'full' | ||
15 | }, | ||
16 | { | ||
17 | path: 'list', | ||
18 | component: VideoBlacklistListComponent, | ||
19 | data: { | ||
20 | meta: { | ||
21 | title: 'Blacklisted videos' | ||
22 | } | ||
23 | } | ||
24 | } | ||
25 | ] | ||
26 | } | ||
27 | ] | ||
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 68719f73d..7d890e72a 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -11,7 +11,7 @@ import { UserService } from './shared' | |||
11 | }) | 11 | }) |
12 | export class AppComponent implements OnInit { | 12 | export class AppComponent implements OnInit { |
13 | notificationOptions = { | 13 | notificationOptions = { |
14 | timeOut: 3000, | 14 | timeOut: 5000, |
15 | lastOnBottom: true, | 15 | lastOnBottom: true, |
16 | clickToClose: true, | 16 | clickToClose: true, |
17 | maxLength: 0, | 17 | maxLength: 0, |
diff --git a/client/src/app/core/menu/menu-admin.component.html b/client/src/app/core/menu/menu-admin.component.html index f512a4e67..edacdee6d 100644 --- a/client/src/app/core/menu/menu-admin.component.html +++ b/client/src/app/core/menu/menu-admin.component.html | |||
@@ -20,7 +20,7 @@ | |||
20 | Video abuses | 20 | Video abuses |
21 | </a> | 21 | </a> |
22 | 22 | ||
23 | <a routerLink="/admin/blacklist/list" routerLinkActive="active"> | 23 | <a routerLink="/admin/video-blacklist/list" routerLinkActive="active"> |
24 | <span class="hidden-xs glyphicon glyphicon-eye-close"></span> | 24 | <span class="hidden-xs glyphicon glyphicon-eye-close"></span> |
25 | Video blacklist | 25 | Video blacklist |
26 | </a> | 26 | </a> |
diff --git a/client/src/app/shared/index.ts b/client/src/app/shared/index.ts index 212645c51..79bf5ef43 100644 --- a/client/src/app/shared/index.ts +++ b/client/src/app/shared/index.ts | |||
@@ -4,5 +4,6 @@ export * from './rest' | |||
4 | export * from './search' | 4 | export * from './search' |
5 | export * from './users' | 5 | export * from './users' |
6 | export * from './video-abuse' | 6 | export * from './video-abuse' |
7 | export * from './video-blacklist' | ||
7 | export * from './shared.module' | 8 | export * from './shared.module' |
8 | export * from './utils' | 9 | export * from './utils' |
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index 56da62fc4..47f651590 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts | |||
@@ -18,6 +18,7 @@ import { RestExtractor, RestService } from './rest' | |||
18 | import { SearchComponent, SearchService } from './search' | 18 | import { SearchComponent, SearchService } from './search' |
19 | import { UserService } from './users' | 19 | import { UserService } from './users' |
20 | import { VideoAbuseService } from './video-abuse' | 20 | import { VideoAbuseService } from './video-abuse' |
21 | import { VideoBlacklistService } from './video-blacklist' | ||
21 | 22 | ||
22 | @NgModule({ | 23 | @NgModule({ |
23 | imports: [ | 24 | imports: [ |
@@ -67,6 +68,7 @@ import { VideoAbuseService } from './video-abuse' | |||
67 | RestService, | 68 | RestService, |
68 | SearchService, | 69 | SearchService, |
69 | VideoAbuseService, | 70 | VideoAbuseService, |
71 | VideoBlacklistService, | ||
70 | UserService | 72 | UserService |
71 | ] | 73 | ] |
72 | }) | 74 | }) |
diff --git a/client/src/app/shared/video-blacklist/index.ts b/client/src/app/shared/video-blacklist/index.ts new file mode 100644 index 000000000..bfb026441 --- /dev/null +++ b/client/src/app/shared/video-blacklist/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './video-blacklist.service' | |||
diff --git a/client/src/app/+admin/blacklist/shared/blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts index ee2bf82e9..17373d52e 100644 --- a/client/src/app/+admin/blacklist/shared/blacklist.service.ts +++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts | |||
@@ -6,13 +6,13 @@ import 'rxjs/add/operator/map' | |||
6 | 6 | ||
7 | import { SortMeta } from 'primeng/components/common/sortmeta' | 7 | import { SortMeta } from 'primeng/components/common/sortmeta' |
8 | 8 | ||
9 | import { RestExtractor, RestPagination, RestService } from '../../../shared' | 9 | import { RestExtractor, RestPagination, RestService } from '../rest' |
10 | import { Utils } from '../../../shared' | 10 | import { Utils } from '../utils' |
11 | import { BlacklistedVideo, ResultList } from '../../../../../../shared' | 11 | import { BlacklistedVideo, ResultList } from '../../../../../shared' |
12 | 12 | ||
13 | @Injectable() | 13 | @Injectable() |
14 | export class BlacklistService { | 14 | export class VideoBlacklistService { |
15 | private static BASE_BLACKLISTS_URL = API_URL + '/api/v1/blacklist/' | 15 | private static BASE_VIDEOS_URL = API_URL + '/api/v1/videos/' |
16 | 16 | ||
17 | constructor ( | 17 | constructor ( |
18 | private authHttp: HttpClient, | 18 | private authHttp: HttpClient, |
@@ -20,22 +20,28 @@ export class BlacklistService { | |||
20 | private restExtractor: RestExtractor | 20 | private restExtractor: RestExtractor |
21 | ) {} | 21 | ) {} |
22 | 22 | ||
23 | getBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<BlacklistedVideo>> { | 23 | listBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<BlacklistedVideo>> { |
24 | let params = new HttpParams() | 24 | let params = new HttpParams() |
25 | params = this.restService.addRestGetParams(params, pagination, sort) | 25 | params = this.restService.addRestGetParams(params, pagination, sort) |
26 | 26 | ||
27 | return this.authHttp.get<ResultList<BlacklistedVideo>>(BlacklistService.BASE_BLACKLISTS_URL, { params }) | 27 | return this.authHttp.get<ResultList<BlacklistedVideo>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params }) |
28 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) | 28 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) |
29 | .map(res => this.restExtractor.applyToResultListData(res, this.formatBlacklistedVideo.bind(this))) | 29 | .map(res => this.restExtractor.applyToResultListData(res, this.formatBlacklistedVideo.bind(this))) |
30 | .catch(res => this.restExtractor.handleError(res)) | 30 | .catch(res => this.restExtractor.handleError(res)) |
31 | } | 31 | } |
32 | 32 | ||
33 | removeVideoFromBlacklist (entry: BlacklistedVideo) { | 33 | removeVideoFromBlacklist (videoId: number) { |
34 | return this.authHttp.delete(BlacklistService.BASE_BLACKLISTS_URL + entry.id) | 34 | return this.authHttp.delete(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist') |
35 | .map(this.restExtractor.extractDataBool) | 35 | .map(this.restExtractor.extractDataBool) |
36 | .catch(res => this.restExtractor.handleError(res)) | 36 | .catch(res => this.restExtractor.handleError(res)) |
37 | } | 37 | } |
38 | 38 | ||
39 | blacklistVideo (videoId: number) { | ||
40 | return this.authHttp.post(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist', {}) | ||
41 | .map(this.restExtractor.extractDataBool) | ||
42 | .catch(res => this.restExtractor.handleError(res)) | ||
43 | } | ||
44 | |||
39 | private formatBlacklistedVideo (blacklistedVideo: BlacklistedVideo) { | 45 | private formatBlacklistedVideo (blacklistedVideo: BlacklistedVideo) { |
40 | return Object.assign(blacklistedVideo, { | 46 | return Object.assign(blacklistedVideo, { |
41 | createdAt: Utils.dateToHuman(blacklistedVideo.createdAt) | 47 | createdAt: Utils.dateToHuman(blacklistedVideo.createdAt) |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 874dd5997..bd98e877c 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -14,7 +14,7 @@ import { VideoMagnetComponent } from './video-magnet.component' | |||
14 | import { VideoShareComponent } from './video-share.component' | 14 | import { VideoShareComponent } from './video-share.component' |
15 | import { VideoReportComponent } from './video-report.component' | 15 | import { VideoReportComponent } from './video-report.component' |
16 | import { Video, VideoService } from '../shared' | 16 | import { Video, VideoService } from '../shared' |
17 | import { WebTorrentService } from './webtorrent.service' | 17 | import { VideoBlacklistService } from '../../shared' |
18 | import { UserVideoRateType, VideoRateType } from '../../../../../shared' | 18 | import { UserVideoRateType, VideoRateType } from '../../../../../shared' |
19 | 19 | ||
20 | @Component({ | 20 | @Component({ |
@@ -45,6 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
45 | private route: ActivatedRoute, | 45 | private route: ActivatedRoute, |
46 | private router: Router, | 46 | private router: Router, |
47 | private videoService: VideoService, | 47 | private videoService: VideoService, |
48 | private videoBlacklistService: VideoBlacklistService, | ||
48 | private confirmService: ConfirmService, | 49 | private confirmService: ConfirmService, |
49 | private metaService: MetaService, | 50 | private metaService: MetaService, |
50 | private authService: AuthService, | 51 | private authService: AuthService, |
@@ -137,15 +138,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
137 | res => { | 138 | res => { |
138 | if (res === false) return | 139 | if (res === false) return |
139 | 140 | ||
140 | this.videoService.blacklistVideo(this.video.id) | 141 | this.videoBlacklistService.blacklistVideo(this.video.id) |
141 | .subscribe( | 142 | .subscribe( |
142 | status => { | 143 | status => { |
143 | this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`) | 144 | this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`) |
144 | this.router.navigate(['/videos/list']) | 145 | this.router.navigate(['/videos/list']) |
145 | }, | 146 | }, |
146 | 147 | ||
147 | error => this.notificationsService.error('Error', error.text) | 148 | error => this.notificationsService.error('Error', error.text) |
148 | ) | 149 | ) |
149 | } | 150 | } |
150 | ) | 151 | ) |
151 | } | 152 | } |
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index 037c20416..fe7f9108d 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts | |||
@@ -122,12 +122,6 @@ export class VideoService { | |||
122 | .catch(res => this.restExtractor.handleError(res)) | 122 | .catch(res => this.restExtractor.handleError(res)) |
123 | } | 123 | } |
124 | 124 | ||
125 | blacklistVideo (id: number) { | ||
126 | return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {}) | ||
127 | .map(this.restExtractor.extractDataBool) | ||
128 | .catch(res => this.restExtractor.handleError(res)) | ||
129 | } | ||
130 | |||
131 | private videoPaginationToRestPagination (videoPagination: VideoPagination) { | 125 | private videoPaginationToRestPagination (videoPagination: VideoPagination) { |
132 | const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage | 126 | const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage |
133 | const count: number = videoPagination.itemsPerPage | 127 | const count: number = videoPagination.itemsPerPage |