aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/following-list/following-list.component.ts
diff options
context:
space:
mode:
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.ts22
1 files changed, 20 insertions, 2 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 dd7629ead..477a6c0d7 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
@@ -1,4 +1,4 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit, ViewChild } from '@angular/core'
2import { Notifier } from '@app/core' 2import { Notifier } from '@app/core'
3import { SortMeta } from 'primeng/api' 3import { SortMeta } from 'primeng/api'
4import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' 4import { ActorFollow } from '../../../../../../shared/models/actors/follow.model'
@@ -6,6 +6,7 @@ import { ConfirmService } from '../../../core/confirm/confirm.service'
6import { RestPagination, RestTable } from '../../../shared' 6import { RestPagination, RestTable } from '../../../shared'
7import { FollowService } from '@app/shared/instance/follow.service' 7import { FollowService } from '@app/shared/instance/follow.service'
8import { I18n } from '@ngx-translate/i18n-polyfill' 8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { BatchDomainsModalComponent } from '@app/+admin/config/shared/batch-domains-modal.component'
9 10
10@Component({ 11@Component({
11 selector: 'my-followers-list', 12 selector: 'my-followers-list',
@@ -13,10 +14,12 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
13 styleUrls: [ './following-list.component.scss' ] 14 styleUrls: [ './following-list.component.scss' ]
14}) 15})
15export class FollowingListComponent extends RestTable implements OnInit { 16export class FollowingListComponent extends RestTable implements OnInit {
17 @ViewChild('batchDomainsModal') batchDomainsModal: BatchDomainsModalComponent
18
16 following: ActorFollow[] = [] 19 following: ActorFollow[] = []
17 totalRecords = 0 20 totalRecords = 0
18 rowsPerPage = 10 21 rowsPerPage = 10
19 sort: SortMeta = { field: 'createdAt', order: 1 } 22 sort: SortMeta = { field: 'createdAt', order: -1 }
20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 23 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
21 24
22 constructor ( 25 constructor (
@@ -36,6 +39,21 @@ export class FollowingListComponent extends RestTable implements OnInit {
36 return 'FollowingListComponent' 39 return 'FollowingListComponent'
37 } 40 }
38 41
42 addDomainsToFollow () {
43 this.batchDomainsModal.openModal()
44 }
45
46 async addFollowing (hosts: string[]) {
47 this.followService.follow(hosts).subscribe(
48 () => {
49 this.notifier.success(this.i18n('Follow request(s) sent!'))
50 this.loadData()
51 },
52
53 err => this.notifier.error(err.message)
54 )
55 }
56
39 async removeFollowing (follow: ActorFollow) { 57 async removeFollowing (follow: ActorFollow) {
40 const res = await this.confirmService.confirm( 58 const res = await this.confirmService.confirm(
41 this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), 59 this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }),