aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-18 15:29:38 +0100
committerChocobozzz <me@florianbigard.com>2020-11-18 15:29:38 +0100
commit0aa52e170727ac6bdf441bcaa2353ae0b8a354ed (patch)
tree52fa047cf9970590cab1dcc7a3e5caa8eb004171 /client/src/app/shared
parentff2cac9fa361a3c5489078f441ed54230c045971 (diff)
downloadPeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.tar.gz
PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.tar.zst
PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.zip
Add ability to display all channel/account videos
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts27
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.html2
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.scss12
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.ts32
4 files changed, 61 insertions, 12 deletions
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 0e2d36081..c8a3ec043 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -134,16 +134,28 @@ export class VideoService implements VideosProvider {
134 ) 134 )
135 } 135 }
136 136
137 getAccountVideos ( 137 getAccountVideos (parameters: {
138 account: Account, 138 account: Account,
139 videoPagination: ComponentPaginationLight, 139 videoPagination: ComponentPaginationLight,
140 sort: VideoSortField 140 sort: VideoSortField
141 ): Observable<ResultList<Video>> { 141 nsfwPolicy?: NSFWPolicyType
142 videoFilter?: VideoFilter
143 }): Observable<ResultList<Video>> {
144 const { account, videoPagination, sort, videoFilter, nsfwPolicy } = parameters
145
142 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 146 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
143 147
144 let params = new HttpParams() 148 let params = new HttpParams()
145 params = this.restService.addRestGetParams(params, pagination, sort) 149 params = this.restService.addRestGetParams(params, pagination, sort)
146 150
151 if (nsfwPolicy) {
152 params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
153 }
154
155 if (videoFilter) {
156 params = params.set('filter', videoFilter)
157 }
158
147 return this.authHttp 159 return this.authHttp
148 .get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params }) 160 .get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
149 .pipe( 161 .pipe(
@@ -152,12 +164,15 @@ export class VideoService implements VideosProvider {
152 ) 164 )
153 } 165 }
154 166
155 getVideoChannelVideos ( 167 getVideoChannelVideos (parameters: {
156 videoChannel: VideoChannel, 168 videoChannel: VideoChannel,
157 videoPagination: ComponentPaginationLight, 169 videoPagination: ComponentPaginationLight,
158 sort: VideoSortField, 170 sort: VideoSortField,
159 nsfwPolicy?: NSFWPolicyType 171 nsfwPolicy?: NSFWPolicyType
160 ): Observable<ResultList<Video>> { 172 videoFilter?: VideoFilter
173 }): Observable<ResultList<Video>> {
174 const { videoChannel, videoPagination, sort, nsfwPolicy, videoFilter } = parameters
175
161 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 176 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
162 177
163 let params = new HttpParams() 178 let params = new HttpParams()
@@ -167,6 +182,10 @@ export class VideoService implements VideosProvider {
167 params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) 182 params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
168 } 183 }
169 184
185 if (videoFilter) {
186 params = params.set('filter', videoFilter)
187 }
188
170 return this.authHttp 189 return this.authHttp
171 .get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/videos', { params }) 190 .get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/videos', { params })
172 .pipe( 191 .pipe(
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.html b/client/src/app/shared/shared-video-miniature/abstract-video-list.html
index 08962dff8..b1ac757db 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.html
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.html
@@ -21,7 +21,7 @@
21 <div class="dropdown-item"> 21 <div class="dropdown-item">
22 <my-peertube-checkbox 22 <my-peertube-checkbox
23 (change)="toggleModerationDisplay()" 23 (change)="toggleModerationDisplay()"
24 inputName="display-unlisted-private" i18n-labelText labelText="Display unlisted and private videos" 24 inputName="display-unlisted-private" i18n-labelText labelText="Display all videos (private, unlisted or not yet published)"
25 ></my-peertube-checkbox> 25 ></my-peertube-checkbox>
26 </div> 26 </div>
27 </div> 27 </div>
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
index 7841b60f7..9077e2f75 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
@@ -31,13 +31,21 @@ $iconSize: 16px;
31 31
32 .moderation-block { 32 .moderation-block {
33 div { 33 div {
34 @include button-with-icon($iconSize, 3px, -1px); 34 @include button-with-icon($iconSize, 3px, -2px);
35 } 35 }
36 36
37 margin-left: .2rem; 37 margin-left: .4rem;
38 display: flex; 38 display: flex;
39 justify-content: flex-end; 39 justify-content: flex-end;
40 align-items: center; 40 align-items: center;
41
42 .dropdown-item {
43 padding: 0;
44
45 ::ng-deep my-peertube-checkbox label {
46 padding: 3px 15px;
47 }
48 }
41 } 49 }
42} 50}
43 51
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
index da05e15fb..2219ced30 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
@@ -15,7 +15,7 @@ import {
15import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' 15import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
16import { GlobalIconName } from '@app/shared/shared-icons' 16import { GlobalIconName } from '@app/shared/shared-icons'
17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date' 17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date'
18import { ServerConfig, VideoSortField } from '@shared/models' 18import { ServerConfig, UserRight, VideoFilter, VideoSortField } from '@shared/models'
19import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' 19import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
20import { Syndication, Video } from '../shared-main' 20import { Syndication, Video } from '../shared-main'
21import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component' 21import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component'
@@ -205,10 +205,6 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
205 this.loadMoreVideos(true) 205 this.loadMoreVideos(true)
206 } 206 }
207 207
208 toggleModerationDisplay () {
209 throw new Error('toggleModerationDisplay is not implemented')
210 }
211
212 removeVideoFromArray (video: Video) { 208 removeVideoFromArray (video: Video) {
213 this.videos = this.videos.filter(v => v.id !== video.id) 209 this.videos = this.videos.filter(v => v.id !== video.id)
214 } 210 }
@@ -268,6 +264,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
268 return this.groupedDateLabels[this.groupedDates[video.id]] 264 return this.groupedDateLabels[this.groupedDates[video.id]]
269 } 265 }
270 266
267 toggleModerationDisplay () {
268 throw new Error('toggleModerationDisplay is not implemented')
269 }
270
271 // On videos hook for children that want to do something 271 // On videos hook for children that want to do something
272 protected onMoreVideos () { /* empty */ } 272 protected onMoreVideos () { /* empty */ }
273 273
@@ -277,6 +277,28 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
277 this.angularState = routeParams[ 'a-state' ] 277 this.angularState = routeParams[ 'a-state' ]
278 } 278 }
279 279
280 protected buildLocalFilter (existing: VideoFilter, base: VideoFilter) {
281 if (base === 'local') {
282 return existing === 'local'
283 ? 'all-local' as 'all-local'
284 : 'local' as 'local'
285 }
286
287 return existing === 'all'
288 ? null
289 : 'all'
290 }
291
292 protected enableAllFilterIfPossible () {
293 if (!this.authService.isLoggedIn()) return
294
295 this.authService.userInformationLoaded
296 .subscribe(() => {
297 const user = this.authService.getUser()
298 this.displayModerationBlock = user.hasRight(UserRight.SEE_ALL_VIDEOS)
299 })
300 }
301
280 private calcPageSizes () { 302 private calcPageSizes () {
281 if (this.screenService.isInMobileView()) { 303 if (this.screenService.isInMobileView()) {
282 this.pagination.itemsPerPage = 5 304 this.pagination.itemsPerPage = 5