aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/following-list
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/follows/following-list')
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.html9
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.ts19
2 files changed, 26 insertions, 2 deletions
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html
index fbcebfaa7..dcc03f4a5 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.html
+++ b/client/src/app/+admin/follows/following-list/following-list.component.html
@@ -7,10 +7,15 @@
7 sortField="createdAt" (onLazyLoad)="loadLazy($event)" 7 sortField="createdAt" (onLazyLoad)="loadLazy($event)"
8 > 8 >
9 <p-column field="id" header="ID"></p-column> 9 <p-column field="id" header="ID"></p-column>
10 <p-column field="host" header="Host"></p-column> 10 <p-column field="following.host" header="Host"></p-column>
11 <p-column field="email" header="Email"></p-column> 11 <p-column field="email" header="Email"></p-column>
12 <p-column field="score" header="Score"></p-column> 12 <p-column field="following.score" header="Score"></p-column>
13 <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> 13 <p-column field="createdAt" header="Created date" [sortable]="true"></p-column>
14 <p-column header="Unfollow" styleClass="action-cell">
15 <ng-template pTemplate="body" let-following="rowData">
16 <span (click)="removeFollowing(following)" class="glyphicon glyphicon-remove glyphicon-black" title="Unfollow"></span>
17 </ng-template>
18 </p-column>
14 </p-dataTable> 19 </p-dataTable>
15 </div> 20 </div>
16</div> 21</div>
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'
2import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
3import { SortMeta } from 'primeng/primeng' 3import { SortMeta } from 'primeng/primeng'
4import { AccountFollow } from '../../../../../../shared/models/accounts/follow.model' 4import { AccountFollow } from '../../../../../../shared/models/accounts/follow.model'
5import { ConfirmService } from '../../../core/confirm/confirm.service'
5import { RestPagination, RestTable } from '../../../shared' 6import { RestPagination, RestTable } from '../../../shared'
6import { FollowService } from '../shared' 7import { 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(