]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
Redesign account page
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-video-channels / account-video-channels.component.ts
index 2e5c5aae216f33f3a8adfd1368607f0c028dd6a4..f2beb6689cffe4b606e6c03a65ca7ddaae5fb45a 100644 (file)
@@ -1,17 +1,9 @@
 import { from, Subject, Subscription } from 'rxjs'
 import { concatMap, map, switchMap, tap } from 'rxjs/operators'
 import { Component, OnDestroy, OnInit } from '@angular/core'
-import { UserService } from '@app/shared'
-import { Account } from '@app/shared/account/account.model'
-import { AccountService } from '@app/shared/account/account.service'
-import { ScreenService } from '@app/shared/misc/screen.service'
-import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model'
-import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
-import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
-import { VideoSortField } from '@app/shared/video/sort-field.type'
-import { Video } from '@app/shared/video/video.model'
-import { VideoService } from '@app/shared/video/video.service'
-import { User } from '@shared/models'
+import { ComponentPagination, hasMoreItems, ScreenService, User, UserService } from '@app/core'
+import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
+import { NSFWPolicyType, VideoSortField } from '@shared/models'
 
 @Component({
   selector: 'my-account-video-channels',
@@ -39,6 +31,7 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
   onChannelDataSubject = new Subject<any>()
 
   userMiniature: User
+  nsfwPolicy: NSFWPolicyType
 
   private accountSub: Subscription
 
@@ -60,7 +53,11 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
         })
 
     this.userService.getAnonymousOrLoggedUser()
-      .subscribe(user => this.userMiniature = user)
+      .subscribe(user => {
+        this.userMiniature = user
+
+        this.nsfwPolicy = user.nsfwPolicy
+      })
   }
 
   ngOnDestroy () {
@@ -73,7 +70,14 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
         tap(res => this.channelPagination.totalItems = res.total),
         switchMap(res => from(res.data)),
         concatMap(videoChannel => {
-          return this.videoService.getVideoChannelVideos(videoChannel, this.videosPagination, this.videosSort)
+          const options = {
+            videoChannel,
+            videoPagination: this.videosPagination,
+            sort: this.videosSort,
+            nsfwPolicy: this.nsfwPolicy
+          }
+
+          return this.videoService.getVideoChannelVideos(options)
             .pipe(map(data => ({ videoChannel, videos: data.data })))
         })
       )