diff options
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+about/about-follows/about-follows.component.html | 10 | ||||
-rw-r--r-- | client/src/app/+about/about-follows/about-follows.component.ts | 19 |
2 files changed, 21 insertions, 8 deletions
diff --git a/client/src/app/+about/about-follows/about-follows.component.html b/client/src/app/+about/about-follows/about-follows.component.html index f16f8bd71..6516b595d 100644 --- a/client/src/app/+about/about-follows/about-follows.component.html +++ b/client/src/app/+about/about-follows/about-follows.component.html | |||
@@ -2,21 +2,21 @@ | |||
2 | <h1 class="visually-hidden" i18n>Follows</h1> | 2 | <h1 class="visually-hidden" i18n>Follows</h1> |
3 | 3 | ||
4 | <div class="col-xl-6 col-md-12"> | 4 | <div class="col-xl-6 col-md-12"> |
5 | <h2 i18n class="subtitle">Follower instances ({{ followersPagination.totalItems }})</h2> | 5 | <h2 i18n class="subtitle">Followers of {{ instanceName }} ({{ followersPagination.totalItems }})</h2> |
6 | 6 | ||
7 | <div i18n class="no-results" *ngIf="followersPagination.totalItems === 0">This instance does not have instances followers.</div> | 7 | <div i18n class="no-results" *ngIf="followersPagination.totalItems === 0">{{ instanceName }} does not have followers.</div> |
8 | 8 | ||
9 | <a *ngFor="let follower of followers" [href]="buildLink(follower)" target="_blank" rel="noopener noreferrer"> | 9 | <a *ngFor="let follower of followers" [href]="buildLink(follower)" target="_blank" rel="noopener noreferrer"> |
10 | {{ follower}} | 10 | {{ follower }} |
11 | </a> | 11 | </a> |
12 | 12 | ||
13 | <button i18n class="show-more" *ngIf="!loadedAllFollowers && canLoadMoreFollowers()" (click)="loadAllFollowers()">Show full list</button> | 13 | <button i18n class="show-more" *ngIf="!loadedAllFollowers && canLoadMoreFollowers()" (click)="loadAllFollowers()">Show full list</button> |
14 | </div> | 14 | </div> |
15 | 15 | ||
16 | <div class="col-xl-6 col-md-12"> | 16 | <div class="col-xl-6 col-md-12"> |
17 | <h2 i18n class="subtitle">Following instances ({{ followingsPagination.totalItems }})</h2> | 17 | <h2 i18n class="subtitle">Subscriptions of {{ instanceName }} ({{ followingsPagination.totalItems }})</h2> |
18 | 18 | ||
19 | <div i18n class="no-results" *ngIf="followingsPagination.totalItems === 0">This instance is not following any other.</div> | 19 | <div i18n class="no-results" *ngIf="followingsPagination.totalItems === 0">{{ instanceName }} does not have subscriptions.</div> |
20 | 20 | ||
21 | <a *ngFor="let following of followings" [href]="buildLink(following)" target="_blank" rel="noopener noreferrer"> | 21 | <a *ngFor="let following of followings" [href]="buildLink(following)" target="_blank" rel="noopener noreferrer"> |
22 | {{ following }} | 22 | {{ following }} |
diff --git a/client/src/app/+about/about-follows/about-follows.component.ts b/client/src/app/+about/about-follows/about-follows.component.ts index 84b47e967..35d810388 100644 --- a/client/src/app/+about/about-follows/about-follows.component.ts +++ b/client/src/app/+about/about-follows/about-follows.component.ts | |||
@@ -1,7 +1,8 @@ | |||
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 { ComponentPagination, hasMoreItems, Notifier, RestService } from '@app/core' | 3 | import { ComponentPagination, hasMoreItems, Notifier, RestService, ServerService } from '@app/core' |
4 | import { InstanceFollowService } from '@app/shared/shared-instance' | 4 | import { InstanceFollowService } from '@app/shared/shared-instance' |
5 | import { Actor } from '@shared/models/actors' | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'my-about-follows', | 8 | selector: 'my-about-follows', |
@@ -10,6 +11,8 @@ import { InstanceFollowService } from '@app/shared/shared-instance' | |||
10 | }) | 11 | }) |
11 | 12 | ||
12 | export class AboutFollowsComponent implements OnInit { | 13 | export class AboutFollowsComponent implements OnInit { |
14 | instanceName: string | ||
15 | |||
13 | followers: string[] = [] | 16 | followers: string[] = [] |
14 | followings: string[] = [] | 17 | followings: string[] = [] |
15 | 18 | ||
@@ -34,6 +37,7 @@ export class AboutFollowsComponent implements OnInit { | |||
34 | } | 37 | } |
35 | 38 | ||
36 | constructor ( | 39 | constructor ( |
40 | private server: ServerService, | ||
37 | private restService: RestService, | 41 | private restService: RestService, |
38 | private notifier: Notifier, | 42 | private notifier: Notifier, |
39 | private followService: InstanceFollowService | 43 | private followService: InstanceFollowService |
@@ -43,6 +47,8 @@ export class AboutFollowsComponent implements OnInit { | |||
43 | this.loadMoreFollowers() | 47 | this.loadMoreFollowers() |
44 | 48 | ||
45 | this.loadMoreFollowings() | 49 | this.loadMoreFollowings() |
50 | |||
51 | this.instanceName = this.server.getHTMLConfig().instance.name | ||
46 | } | 52 | } |
47 | 53 | ||
48 | loadAllFollowings () { | 54 | loadAllFollowings () { |
@@ -95,7 +101,7 @@ export class AboutFollowsComponent implements OnInit { | |||
95 | next: resultList => { | 101 | next: resultList => { |
96 | if (reset) this.followers = [] | 102 | if (reset) this.followers = [] |
97 | 103 | ||
98 | const newFollowers = resultList.data.map(r => r.follower.host) | 104 | const newFollowers = resultList.data.map(r => this.formatFollow(r.follower)) |
99 | this.followers = this.followers.concat(newFollowers) | 105 | this.followers = this.followers.concat(newFollowers) |
100 | 106 | ||
101 | this.followersPagination.totalItems = resultList.total | 107 | this.followersPagination.totalItems = resultList.total |
@@ -113,7 +119,7 @@ export class AboutFollowsComponent implements OnInit { | |||
113 | next: resultList => { | 119 | next: resultList => { |
114 | if (reset) this.followings = [] | 120 | if (reset) this.followings = [] |
115 | 121 | ||
116 | const newFollowings = resultList.data.map(r => r.following.host) | 122 | const newFollowings = resultList.data.map(r => this.formatFollow(r.following)) |
117 | this.followings = this.followings.concat(newFollowings) | 123 | this.followings = this.followings.concat(newFollowings) |
118 | 124 | ||
119 | this.followingsPagination.totalItems = resultList.total | 125 | this.followingsPagination.totalItems = resultList.total |
@@ -123,4 +129,11 @@ export class AboutFollowsComponent implements OnInit { | |||
123 | }) | 129 | }) |
124 | } | 130 | } |
125 | 131 | ||
132 | private formatFollow (actor: Actor) { | ||
133 | // Instance follow, only display host | ||
134 | if (actor.name === 'peertube') return actor.host | ||
135 | |||
136 | return actor.name + '@' + actor.host | ||
137 | } | ||
138 | |||
126 | } | 139 | } |