diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-27 11:05:32 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-27 13:52:13 +0200 |
commit | 073deef8862f462de5f159a57877ef415ebe4c69 (patch) | |
tree | 256d5ff4483ef68b07754f767626a72ac793bd5f /client/src/app/+admin/follows | |
parent | 3267d381f4fdd128b2f948670b2e2ba765145276 (diff) | |
download | PeerTube-073deef8862f462de5f159a57877ef415ebe4c69.tar.gz PeerTube-073deef8862f462de5f159a57877ef415ebe4c69.tar.zst PeerTube-073deef8862f462de5f159a57877ef415ebe4c69.zip |
Handle rejected follows in client
Also add quick filters so it's easier to find pending follows
Diffstat (limited to 'client/src/app/+admin/follows')
4 files changed, 25 insertions, 19 deletions
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html index 3081098c4..4f11f261d 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.html +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html | |||
@@ -13,7 +13,7 @@ | |||
13 | <ng-template pTemplate="caption"> | 13 | <ng-template pTemplate="caption"> |
14 | <div class="caption"> | 14 | <div class="caption"> |
15 | <div class="ms-auto"> | 15 | <div class="ms-auto"> |
16 | <my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter> | 16 | <my-advanced-input-filter [filters]="searchFilters" (search)="onSearch($event)"></my-advanced-input-filter> |
17 | </div> | 17 | </div> |
18 | </div> | 18 | </div> |
19 | </ng-template> | 19 | </ng-template> |
@@ -31,12 +31,10 @@ | |||
31 | <ng-template pTemplate="body" let-follow> | 31 | <ng-template pTemplate="body" let-follow> |
32 | <tr> | 32 | <tr> |
33 | <td class="action-cell"> | 33 | <td class="action-cell"> |
34 | <ng-container *ngIf="follow.state === 'pending'"> | 34 | <my-button *ngIf="follow.state !== 'accepted'" i18n-title title="Accept" icon="tick" (click)="acceptFollower(follow)"></my-button> |
35 | <my-button i18n-title title="Accept" icon="tick" (click)="acceptFollower(follow)"></my-button> | 35 | <my-button *ngIf="follow.state !== 'rejected'" i18n-title title="Refuse" icon="cross" (click)="rejectFollower(follow)"></my-button> |
36 | <my-button i18n-title title="Refuse" icon="cross" (click)="rejectFollower(follow)"></my-button> | ||
37 | </ng-container> | ||
38 | 36 | ||
39 | <my-delete-button label *ngIf="follow.state === 'accepted'" (click)="deleteFollower(follow)"></my-delete-button> | 37 | <my-delete-button *ngIf="follow.state === 'rejected'" (click)="deleteFollower(follow)"></my-delete-button> |
40 | </td> | 38 | </td> |
41 | <td> | 39 | <td> |
42 | <a [href]="follow.follower.url" i18n-title title="Open actor page in a new tab" target="_blank" rel="noopener noreferrer"> | 40 | <a [href]="follow.follower.url" i18n-title title="Open actor page in a new tab" target="_blank" rel="noopener noreferrer"> |
@@ -45,11 +43,10 @@ | |||
45 | </a> | 43 | </a> |
46 | </td> | 44 | </td> |
47 | 45 | ||
48 | <td *ngIf="follow.state === 'accepted'"> | 46 | <td> |
49 | <span class="pt-badge badge-green" i18n>Accepted</span> | 47 | <span *ngIf="follow.state === 'accepted'" class="pt-badge badge-green" i18n>Accepted</span> |
50 | </td> | 48 | <span *ngIf="follow.state === 'pending'" class="pt-badge badge-yellow" i18n>Pending</span> |
51 | <td *ngIf="follow.state === 'pending'"> | 49 | <span *ngIf="follow.state === 'rejected'" class="pt-badge badge-red" i18n>Rejected</span> |
52 | <span class="pt-badge badge-yellow" i18n>Pending</span> | ||
53 | </td> | 50 | </td> |
54 | 51 | ||
55 | <td>{{ follow.score }}</td> | 52 | <td>{{ follow.score }}</td> |
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 329e3bcc7..d09e74fef 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | ||
4 | import { InstanceFollowService } from '@app/shared/shared-instance' | 5 | import { InstanceFollowService } from '@app/shared/shared-instance' |
5 | import { ActorFollow } from '@shared/models' | 6 | import { ActorFollow } from '@shared/models' |
6 | 7 | ||
@@ -15,12 +16,16 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
15 | sort: SortMeta = { field: 'createdAt', order: -1 } | 16 | sort: SortMeta = { field: 'createdAt', order: -1 } |
16 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 17 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
17 | 18 | ||
19 | searchFilters: AdvancedInputFilter[] | ||
20 | |||
18 | constructor ( | 21 | constructor ( |
19 | private confirmService: ConfirmService, | 22 | private confirmService: ConfirmService, |
20 | private notifier: Notifier, | 23 | private notifier: Notifier, |
21 | private followService: InstanceFollowService | 24 | private followService: InstanceFollowService |
22 | ) { | 25 | ) { |
23 | super() | 26 | super() |
27 | |||
28 | this.searchFilters = this.followService.buildFollowsListFilters() | ||
24 | } | 29 | } |
25 | 30 | ||
26 | ngOnInit () { | 31 | ngOnInit () { |
@@ -70,7 +75,7 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
70 | } | 75 | } |
71 | 76 | ||
72 | async deleteFollower (follow: ActorFollow) { | 77 | async deleteFollower (follow: ActorFollow) { |
73 | const message = $localize`Do you really want to delete this follower?` | 78 | const message = $localize`Do you really want to delete this follower? It will be able to send again another follow request.` |
74 | const res = await this.confirmService.confirm(message, $localize`Delete`) | 79 | const res = await this.confirmService.confirm(message, $localize`Delete`) |
75 | if (res === false) return | 80 | if (res === false) return |
76 | 81 | ||
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 302dc9528..856c4a31f 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 | |||
@@ -20,7 +20,7 @@ | |||
20 | </div> | 20 | </div> |
21 | 21 | ||
22 | <div class="ms-auto"> | 22 | <div class="ms-auto"> |
23 | <my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter> | 23 | <my-advanced-input-filter [filters]="searchFilters" (search)="onSearch($event)"></my-advanced-input-filter> |
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | </ng-template> | 26 | </ng-template> |
@@ -47,11 +47,10 @@ | |||
47 | </a> | 47 | </a> |
48 | </td> | 48 | </td> |
49 | 49 | ||
50 | <td *ngIf="follow.state === 'accepted'"> | 50 | <td> |
51 | <span class="pt-badge badge-green" i18n>Accepted</span> | 51 | <span *ngIf="follow.state === 'accepted'" class="pt-badge badge-green" i18n>Accepted</span> |
52 | </td> | 52 | <span *ngIf="follow.state === 'pending'" class="pt-badge badge-yellow" i18n>Pending</span> |
53 | <td *ngIf="follow.state === 'pending'"> | 53 | <span *ngIf="follow.state === 'rejected'" class="pt-badge badge-red" i18n>Rejected</span> |
54 | <span class="pt-badge badge-yellow" i18n>Pending</span> | ||
55 | </td> | 54 | </td> |
56 | 55 | ||
57 | <td>{{ follow.createdAt | date: 'short' }}</td> | 56 | <td>{{ follow.createdAt | date: 'short' }}</td> |
@@ -66,7 +65,7 @@ | |||
66 | 65 | ||
67 | <ng-template pTemplate="emptymessage"> | 66 | <ng-template pTemplate="emptymessage"> |
68 | <tr> | 67 | <tr> |
69 | <td colspan="6"> | 68 | <td colspan="5"> |
70 | <div class="no-results"> | 69 | <div class="no-results"> |
71 | <ng-container *ngIf="search" i18n>No host found matching current filters.</ng-container> | 70 | <ng-container *ngIf="search" i18n>No host found matching current filters.</ng-container> |
72 | <ng-container *ngIf="!search" i18n>Your instance is not following anyone.</ng-container> | 71 | <ng-container *ngIf="!search" i18n>Your instance is not following anyone.</ng-container> |
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 2c0f6db0c..7a854be81 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,6 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | ||
4 | import { InstanceFollowService } from '@app/shared/shared-instance' | 5 | import { InstanceFollowService } from '@app/shared/shared-instance' |
5 | import { ActorFollow } from '@shared/models' | 6 | import { ActorFollow } from '@shared/models' |
6 | import { FollowModalComponent } from './follow-modal.component' | 7 | import { FollowModalComponent } from './follow-modal.component' |
@@ -17,12 +18,16 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
17 | sort: SortMeta = { field: 'createdAt', order: -1 } | 18 | sort: SortMeta = { field: 'createdAt', order: -1 } |
18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
19 | 20 | ||
21 | searchFilters: AdvancedInputFilter[] | ||
22 | |||
20 | constructor ( | 23 | constructor ( |
21 | private notifier: Notifier, | 24 | private notifier: Notifier, |
22 | private confirmService: ConfirmService, | 25 | private confirmService: ConfirmService, |
23 | private followService: InstanceFollowService | 26 | private followService: InstanceFollowService |
24 | ) { | 27 | ) { |
25 | super() | 28 | super() |
29 | |||
30 | this.searchFilters = this.followService.buildFollowsListFilters() | ||
26 | } | 31 | } |
27 | 32 | ||
28 | ngOnInit () { | 33 | ngOnInit () { |