diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-20 11:19:23 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 7e9334c34db23e5ad1e118151b24c720dd985984 (patch) | |
tree | 154f5d1db44ff652b793d8e0b7dc1b00a3ddaec1 /client/src/app/+admin/follows/following-list/following-list.component.ts | |
parent | 892211e8493b1f992fce7616cb1e48b7ff87a1dc (diff) | |
download | PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.tar.gz PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.tar.zst PeerTube-7e9334c34db23e5ad1e118151b24c720dd985984.zip |
Add ability to unfollow a server
Diffstat (limited to 'client/src/app/+admin/follows/following-list/following-list.component.ts')
-rw-r--r-- | client/src/app/+admin/follows/following-list/following-list.component.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index a1dff1db3..411b8f640 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts | |||
@@ -2,6 +2,7 @@ import { Component } from '@angular/core' | |||
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
3 | import { SortMeta } from 'primeng/primeng' | 3 | import { SortMeta } from 'primeng/primeng' |
4 | import { AccountFollow } from '../../../../../../shared/models/accounts/follow.model' | 4 | import { AccountFollow } from '../../../../../../shared/models/accounts/follow.model' |
5 | import { ConfirmService } from '../../../core/confirm/confirm.service' | ||
5 | import { RestPagination, RestTable } from '../../../shared' | 6 | import { RestPagination, RestTable } from '../../../shared' |
6 | import { FollowService } from '../shared' | 7 | import { FollowService } from '../shared' |
7 | 8 | ||
@@ -18,11 +19,29 @@ export class FollowingListComponent extends RestTable { | |||
18 | 19 | ||
19 | constructor ( | 20 | constructor ( |
20 | private notificationsService: NotificationsService, | 21 | private notificationsService: NotificationsService, |
22 | private confirmService: ConfirmService, | ||
21 | private followService: FollowService | 23 | private followService: FollowService |
22 | ) { | 24 | ) { |
23 | super() | 25 | super() |
24 | } | 26 | } |
25 | 27 | ||
28 | removeFollowing (follow: AccountFollow) { | ||
29 | this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow').subscribe( | ||
30 | res => { | ||
31 | if (res === false) return | ||
32 | |||
33 | this.followService.unfollow(follow).subscribe( | ||
34 | () => { | ||
35 | this.notificationsService.success('Success', `You are not following ${follow.following.host} anymore.`) | ||
36 | this.loadData() | ||
37 | }, | ||
38 | |||
39 | err => this.notificationsService.error('Error', err.message) | ||
40 | ) | ||
41 | } | ||
42 | ) | ||
43 | } | ||
44 | |||
26 | protected loadData () { | 45 | protected loadData () { |
27 | this.followService.getFollowing(this.pagination, this.sort) | 46 | this.followService.getFollowing(this.pagination, this.sort) |
28 | .subscribe( | 47 | .subscribe( |