diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-19 09:44:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:25:44 +0200 |
commit | 4beda9e12adc7b1f3b178cecd6863ebf3cf431f1 (patch) | |
tree | 6244a10b286d66c6dcd7799aee630670d0493781 /client/src/app/shared | |
parent | 9593a78ae1368a9ad8bb11044fce6fde2892701a (diff) | |
download | PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.tar.gz PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.tar.zst PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.zip |
Add ability to view my followers
Diffstat (limited to 'client/src/app/shared')
11 files changed, 54 insertions, 17 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html b/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html index dd7a56d7d..0ca84ff78 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html +++ b/client/src/app/shared/shared-custom-markup/custom-markup-help.component.html | |||
@@ -1,3 +1,3 @@ | |||
1 | <ng-container i18n> | 1 | <ng-container i18n> |
2 | <a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noreferer noopener">Markdown compatible</a> that also supports <a href="https://docs.joinpeertube.org/api-custom-client-markup" target="_blank" rel="noreferer noopener">custom PeerTube HTML tags</a> | 2 | <a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noreferrer noopener">Markdown compatible</a> that also supports <a href="https://docs.joinpeertube.org/api-custom-client-markup" target="_blank" rel="noreferrer noopener">custom PeerTube HTML tags</a> |
3 | </ng-container> | 3 | </ng-container> |
diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts index 72cd6d460..113219f48 100644 --- a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts | |||
@@ -77,6 +77,8 @@ export class AdvancedInputFilterComponent implements OnInit, AfterViewInit { | |||
77 | 77 | ||
78 | logger('On route search change "%s".', search) | 78 | logger('On route search change "%s".', search) |
79 | 79 | ||
80 | if (this.searchValue === search) return | ||
81 | |||
80 | this.searchValue = search | 82 | this.searchValue = search |
81 | this.emitSearch() | 83 | this.emitSearch() |
82 | }) | 84 | }) |
diff --git a/client/src/app/shared/shared-main/users/user-history.service.ts b/client/src/app/shared/shared-main/users/user-history.service.ts index 91268af8c..a4841897d 100644 --- a/client/src/app/shared/shared-main/users/user-history.service.ts +++ b/client/src/app/shared/shared-main/users/user-history.service.ts | |||
@@ -19,7 +19,7 @@ export class UserHistoryService { | |||
19 | ) {} | 19 | ) {} |
20 | 20 | ||
21 | getUserVideosHistory (historyPagination: ComponentPaginationLight, search?: string) { | 21 | getUserVideosHistory (historyPagination: ComponentPaginationLight, search?: string) { |
22 | const pagination = this.restService.componentPaginationToRestPagination(historyPagination) | 22 | const pagination = this.restService.componentToRestPagination(historyPagination) |
23 | 23 | ||
24 | let params = new HttpParams() | 24 | let params = new HttpParams() |
25 | params = this.restService.addRestGetParams(params, pagination) | 25 | params = this.restService.addRestGetParams(params, pagination) |
diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts index 09fee87a3..e27dab21a 100644 --- a/client/src/app/shared/shared-main/users/user-notification.service.ts +++ b/client/src/app/shared/shared-main/users/user-notification.service.ts | |||
@@ -29,7 +29,7 @@ export class UserNotificationService { | |||
29 | const { pagination, ignoreLoadingBar, unread, sort } = parameters | 29 | const { pagination, ignoreLoadingBar, unread, sort } = parameters |
30 | 30 | ||
31 | let params = new HttpParams() | 31 | let params = new HttpParams() |
32 | params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination), sort) | 32 | params = this.restService.addRestGetParams(params, this.restService.componentToRestPagination(pagination), sort) |
33 | 33 | ||
34 | if (unread) params = params.append('unread', `${unread}`) | 34 | if (unread) params = params.append('unread', `${unread}`) |
35 | 35 | ||
diff --git a/client/src/app/shared/shared-main/users/user-notifications.component.html b/client/src/app/shared/shared-main/users/user-notifications.component.html index ee8df864a..9af6da784 100644 --- a/client/src/app/shared/shared-main/users/user-notifications.component.html +++ b/client/src/app/shared/shared-main/users/user-notifications.component.html | |||
@@ -203,7 +203,7 @@ | |||
203 | <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon> | 203 | <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon> |
204 | 204 | ||
205 | <div class="message" i18n> | 205 | <div class="message" i18n> |
206 | <a (click)="markAsRead(notification)" [href]="notification.peertubeVersionLink" target="_blank" rel="noopener noreferer">A new version of PeerTube</a> is available: {{ notification.peertube.latestVersion }} | 206 | <a (click)="markAsRead(notification)" [href]="notification.peertubeVersionLink" target="_blank" rel="noopener noreferrer">A new version of PeerTube</a> is available: {{ notification.peertube.latestVersion }} |
207 | </div> | 207 | </div> |
208 | </ng-container> | 208 | </ng-container> |
209 | 209 | ||
diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts index 7560a35a8..dc00fabdc 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts | |||
@@ -50,7 +50,7 @@ export class VideoChannelService { | |||
50 | const { account, componentPagination, withStats = false, sort, search } = options | 50 | const { account, componentPagination, withStats = false, sort, search } = options |
51 | 51 | ||
52 | const pagination = componentPagination | 52 | const pagination = componentPagination |
53 | ? this.restService.componentPaginationToRestPagination(componentPagination) | 53 | ? this.restService.componentToRestPagination(componentPagination) |
54 | : { start: 0, count: 20 } | 54 | : { start: 0, count: 20 } |
55 | 55 | ||
56 | let params = new HttpParams() | 56 | let params = new HttpParams() |
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 3481b116f..2f43f1b9d 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -123,7 +123,7 @@ export class VideoService { | |||
123 | } | 123 | } |
124 | 124 | ||
125 | getMyVideos (videoPagination: ComponentPaginationLight, sort: VideoSortField, search?: string): Observable<ResultList<Video>> { | 125 | getMyVideos (videoPagination: ComponentPaginationLight, sort: VideoSortField, search?: string): Observable<ResultList<Video>> { |
126 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 126 | const pagination = this.restService.componentToRestPagination(videoPagination) |
127 | 127 | ||
128 | let params = new HttpParams() | 128 | let params = new HttpParams() |
129 | params = this.restService.addRestGetParams(params, pagination, sort) | 129 | params = this.restService.addRestGetParams(params, pagination, sort) |
@@ -377,7 +377,7 @@ export class VideoService { | |||
377 | private buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) { | 377 | private buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) { |
378 | const { params, videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy, isLive, nsfw } = options | 378 | const { params, videoPagination, sort, filter, categoryOneOf, languageOneOf, skipCount, nsfwPolicy, isLive, nsfw } = options |
379 | 379 | ||
380 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 380 | const pagination = this.restService.componentToRestPagination(videoPagination) |
381 | let newParams = this.restService.addRestGetParams(params, pagination, sort) | 381 | let newParams = this.restService.addRestGetParams(params, pagination, sort) |
382 | 382 | ||
383 | if (filter) newParams = newParams.set('filter', filter) | 383 | if (filter) newParams = newParams.set('filter', filter) |
diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.ts index fdfab0e0e..71350c733 100644 --- a/client/src/app/shared/shared-search/search.service.ts +++ b/client/src/app/shared/shared-search/search.service.ts | |||
@@ -43,7 +43,7 @@ export class SearchService { | |||
43 | let pagination: RestPagination | 43 | let pagination: RestPagination |
44 | 44 | ||
45 | if (componentPagination) { | 45 | if (componentPagination) { |
46 | pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 46 | pagination = this.restService.componentToRestPagination(componentPagination) |
47 | } | 47 | } |
48 | 48 | ||
49 | let params = new HttpParams() | 49 | let params = new HttpParams() |
@@ -77,7 +77,7 @@ export class SearchService { | |||
77 | 77 | ||
78 | let pagination: RestPagination | 78 | let pagination: RestPagination |
79 | if (componentPagination) { | 79 | if (componentPagination) { |
80 | pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 80 | pagination = this.restService.componentToRestPagination(componentPagination) |
81 | } | 81 | } |
82 | 82 | ||
83 | let params = new HttpParams() | 83 | let params = new HttpParams() |
@@ -111,7 +111,7 @@ export class SearchService { | |||
111 | 111 | ||
112 | let pagination: RestPagination | 112 | let pagination: RestPagination |
113 | if (componentPagination) { | 113 | if (componentPagination) { |
114 | pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 114 | pagination = this.restService.componentToRestPagination(componentPagination) |
115 | } | 115 | } |
116 | 116 | ||
117 | let params = new HttpParams() | 117 | let params = new HttpParams() |
diff --git a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts index f289fb6cf..ede65ff39 100644 --- a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts +++ b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts | |||
@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core' | |||
6 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' | 6 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' |
7 | import { buildBulkObservable } from '@app/helpers' | 7 | import { buildBulkObservable } from '@app/helpers' |
8 | import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' |
9 | import { ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' | 9 | import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models' |
10 | import { environment } from '../../../environments/environment' | 10 | import { environment } from '../../../environments/environment' |
11 | 11 | ||
12 | const logger = debug('peertube:subscriptions:UserSubscriptionService') | 12 | const logger = debug('peertube:subscriptions:UserSubscriptionService') |
@@ -17,6 +17,8 @@ type SubscriptionExistResultObservable = { [ uri: string ]: Observable<boolean> | |||
17 | @Injectable() | 17 | @Injectable() |
18 | export class UserSubscriptionService { | 18 | export class UserSubscriptionService { |
19 | static BASE_USER_SUBSCRIPTIONS_URL = environment.apiUrl + '/api/v1/users/me/subscriptions' | 19 | static BASE_USER_SUBSCRIPTIONS_URL = environment.apiUrl + '/api/v1/users/me/subscriptions' |
20 | static BASE_VIDEO_CHANNELS_URL = environment.apiUrl + '/api/v1/video-channels' | ||
21 | static BASE_ACCOUNTS_URL = environment.apiUrl + '/api/v1/accounts' | ||
20 | 22 | ||
21 | // Use a replay subject because we "next" a value before subscribing | 23 | // Use a replay subject because we "next" a value before subscribing |
22 | private existsSubject = new ReplaySubject<string>(1) | 24 | private existsSubject = new ReplaySubject<string>(1) |
@@ -43,13 +45,46 @@ export class UserSubscriptionService { | |||
43 | ) | 45 | ) |
44 | } | 46 | } |
45 | 47 | ||
48 | listFollowers (parameters: { | ||
49 | pagination: ComponentPaginationLight | ||
50 | nameWithHost: string | ||
51 | search?: string | ||
52 | }) { | ||
53 | const { pagination, nameWithHost, search } = parameters | ||
54 | |||
55 | let url = `${UserSubscriptionService.BASE_ACCOUNTS_URL}/${nameWithHost}/followers` | ||
56 | |||
57 | let params = new HttpParams() | ||
58 | params = this.restService.addRestGetParams(params, this.restService.componentToRestPagination(pagination), '-createdAt') | ||
59 | |||
60 | if (search) { | ||
61 | const filters = this.restService.parseQueryStringFilter(search, { | ||
62 | channel: { | ||
63 | prefix: 'channel:' | ||
64 | } | ||
65 | }) | ||
66 | |||
67 | if (filters.channel) { | ||
68 | url = `${UserSubscriptionService.BASE_VIDEO_CHANNELS_URL}/${filters.channel}/followers` | ||
69 | } | ||
70 | |||
71 | params = this.restService.addObjectParams(params, { search: filters.search }) | ||
72 | } | ||
73 | |||
74 | return this.authHttp | ||
75 | .get<ResultList<ActorFollow>>(url, { params }) | ||
76 | .pipe( | ||
77 | catchError(err => this.restExtractor.handleError(err)) | ||
78 | ) | ||
79 | } | ||
80 | |||
46 | getUserSubscriptionVideos (parameters: { | 81 | getUserSubscriptionVideos (parameters: { |
47 | videoPagination: ComponentPaginationLight | 82 | videoPagination: ComponentPaginationLight |
48 | sort: VideoSortField | 83 | sort: VideoSortField |
49 | skipCount?: boolean | 84 | skipCount?: boolean |
50 | }): Observable<ResultList<Video>> { | 85 | }): Observable<ResultList<Video>> { |
51 | const { videoPagination, sort, skipCount } = parameters | 86 | const { videoPagination, sort, skipCount } = parameters |
52 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 87 | const pagination = this.restService.componentToRestPagination(videoPagination) |
53 | 88 | ||
54 | let params = new HttpParams() | 89 | let params = new HttpParams() |
55 | params = this.restService.addRestGetParams(params, pagination, sort) | 90 | params = this.restService.addRestGetParams(params, pagination, sort) |
@@ -106,7 +141,7 @@ export class UserSubscriptionService { | |||
106 | const { pagination, search } = parameters | 141 | const { pagination, search } = parameters |
107 | const url = UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL | 142 | const url = UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL |
108 | 143 | ||
109 | const restPagination = this.restService.componentPaginationToRestPagination(pagination) | 144 | const restPagination = this.restService.componentToRestPagination(pagination) |
110 | 145 | ||
111 | let params = new HttpParams() | 146 | let params = new HttpParams() |
112 | params = this.restService.addRestGetParams(params, restPagination) | 147 | params = this.restService.addRestGetParams(params, restPagination) |
diff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.ts index 5550c96e4..fd1cae7f8 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.service.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts | |||
@@ -81,7 +81,7 @@ export class VideoCommentService { | |||
81 | }): Observable<ThreadsResultList<VideoComment>> { | 81 | }): Observable<ThreadsResultList<VideoComment>> { |
82 | const { videoId, componentPagination, sort } = parameters | 82 | const { videoId, componentPagination, sort } = parameters |
83 | 83 | ||
84 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 84 | const pagination = this.restService.componentToRestPagination(componentPagination) |
85 | 85 | ||
86 | let params = new HttpParams() | 86 | let params = new HttpParams() |
87 | params = this.restService.addRestGetParams(params, pagination, sort) | 87 | params = this.restService.addRestGetParams(params, pagination, sort) |
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts index fc291329a..3faf81d11 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts | |||
@@ -62,7 +62,7 @@ export class VideoPlaylistService { | |||
62 | 62 | ||
63 | listChannelPlaylists (videoChannel: VideoChannel, componentPagination: ComponentPaginationLight): Observable<ResultList<VideoPlaylist>> { | 63 | listChannelPlaylists (videoChannel: VideoChannel, componentPagination: ComponentPaginationLight): Observable<ResultList<VideoPlaylist>> { |
64 | const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/video-playlists' | 64 | const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/video-playlists' |
65 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 65 | const pagination = this.restService.componentToRestPagination(componentPagination) |
66 | 66 | ||
67 | let params = new HttpParams() | 67 | let params = new HttpParams() |
68 | params = this.restService.addRestGetParams(params, pagination) | 68 | params = this.restService.addRestGetParams(params, pagination) |
@@ -103,7 +103,7 @@ export class VideoPlaylistService { | |||
103 | ): Observable<ResultList<VideoPlaylist>> { | 103 | ): Observable<ResultList<VideoPlaylist>> { |
104 | const url = AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-playlists' | 104 | const url = AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-playlists' |
105 | const pagination = componentPagination | 105 | const pagination = componentPagination |
106 | ? this.restService.componentPaginationToRestPagination(componentPagination) | 106 | ? this.restService.componentToRestPagination(componentPagination) |
107 | : undefined | 107 | : undefined |
108 | 108 | ||
109 | let params = new HttpParams() | 109 | let params = new HttpParams() |
@@ -259,7 +259,7 @@ export class VideoPlaylistService { | |||
259 | componentPagination: ComponentPaginationLight | 259 | componentPagination: ComponentPaginationLight |
260 | }): Observable<ResultList<VideoPlaylistElement>> { | 260 | }): Observable<ResultList<VideoPlaylistElement>> { |
261 | const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + options.videoPlaylistId + '/videos' | 261 | const path = VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + options.videoPlaylistId + '/videos' |
262 | const pagination = this.restService.componentPaginationToRestPagination(options.componentPagination) | 262 | const pagination = this.restService.componentToRestPagination(options.componentPagination) |
263 | 263 | ||
264 | let params = new HttpParams() | 264 | let params = new HttpParams() |
265 | params = this.restService.addRestGetParams(params, pagination) | 265 | params = this.restService.addRestGetParams(params, pagination) |