diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-22 15:29:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-22 15:29:32 +0100 |
commit | 1f30a1853e38c20a45722dbd6d38aaaec63839e8 (patch) | |
tree | cdce8cc9fcc62d9b3343c9478b1dbcefedcea972 /client/src/app/+admin/follows | |
parent | 78967fca4cacbc247fa6fb62d64b2d6825a10804 (diff) | |
download | PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.gz PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.tar.zst PeerTube-1f30a1853e38c20a45722dbd6d38aaaec63839e8.zip |
Add confirm when admin use custom js/css
Diffstat (limited to 'client/src/app/+admin/follows')
-rw-r--r-- | client/src/app/+admin/follows/following-add/following-add.component.ts | 21 | ||||
-rw-r--r-- | client/src/app/+admin/follows/following-list/following-list.component.ts | 21 |
2 files changed, 18 insertions, 24 deletions
diff --git a/client/src/app/+admin/follows/following-add/following-add.component.ts b/client/src/app/+admin/follows/following-add/following-add.component.ts index bf842129d..c296c8852 100644 --- a/client/src/app/+admin/follows/following-add/following-add.component.ts +++ b/client/src/app/+admin/follows/following-add/following-add.component.ts | |||
@@ -43,7 +43,7 @@ export class FollowingAddComponent { | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | addFollowing () { | 46 | async addFollowing () { |
47 | this.error = '' | 47 | this.error = '' |
48 | 48 | ||
49 | const hosts = this.getNotEmptyHosts() | 49 | const hosts = this.getNotEmptyHosts() |
@@ -57,20 +57,17 @@ export class FollowingAddComponent { | |||
57 | } | 57 | } |
58 | 58 | ||
59 | const confirmMessage = 'If you confirm, you will send a follow request to:<br /> - ' + hosts.join('<br /> - ') | 59 | const confirmMessage = 'If you confirm, you will send a follow request to:<br /> - ' + hosts.join('<br /> - ') |
60 | this.confirmService.confirm(confirmMessage, 'Follow new server(s)').subscribe( | 60 | const res = await this.confirmService.confirm(confirmMessage, 'Follow new server(s)') |
61 | res => { | 61 | if (res === false) return |
62 | if (res === false) return | ||
63 | 62 | ||
64 | this.followService.follow(hosts).subscribe( | 63 | this.followService.follow(hosts).subscribe( |
65 | status => { | 64 | () => { |
66 | this.notificationsService.success('Success', 'Follow request(s) sent!') | 65 | this.notificationsService.success('Success', 'Follow request(s) sent!') |
67 | 66 | ||
68 | setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) | 67 | setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) |
69 | }, | 68 | }, |
70 | 69 | ||
71 | err => this.notificationsService.error('Error', err.message) | 70 | err => this.notificationsService.error('Error', err.message) |
72 | ) | ||
73 | } | ||
74 | ) | 71 | ) |
75 | } | 72 | } |
76 | 73 | ||
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 d4f8d0309..ad1bd4536 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 | |||
@@ -25,20 +25,17 @@ export class FollowingListComponent extends RestTable { | |||
25 | super() | 25 | super() |
26 | } | 26 | } |
27 | 27 | ||
28 | removeFollowing (follow: AccountFollow) { | 28 | async removeFollowing (follow: AccountFollow) { |
29 | this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow').subscribe( | 29 | const res = await this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow') |
30 | res => { | 30 | if (res === false) return |
31 | if (res === false) return | ||
32 | 31 | ||
33 | this.followService.unfollow(follow).subscribe( | 32 | this.followService.unfollow(follow).subscribe( |
34 | () => { | 33 | () => { |
35 | this.notificationsService.success('Success', `You are not following ${follow.following.host} anymore.`) | 34 | this.notificationsService.success('Success', `You are not following ${follow.following.host} anymore.`) |
36 | this.loadData() | 35 | this.loadData() |
37 | }, | 36 | }, |
38 | 37 | ||
39 | err => this.notificationsService.error('Error', err.message) | 38 | err => this.notificationsService.error('Error', err.message) |
40 | ) | ||
41 | } | ||
42 | ) | 39 | ) |
43 | } | 40 | } |
44 | 41 | ||