import { VideoService } from '../../shared/video/video.service'
import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
-import { tap } from 'rxjs/operators'
+import { first, tap } from 'rxjs/operators'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { Subscription } from 'rxjs'
import { ScreenService } from '@app/shared/misc/screen.service'
})
export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
titlePage: string
- marginContent = false // Disable margin
loadOnInit = false
private videoChannel: VideoChannel
private videoChannelSub: Subscription
constructor (
+ protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
protected notifier: Notifier,
protected confirmService: ConfirmService,
protected screenService: ScreenService,
- private i18n: I18n,
private videoChannelService: VideoChannelService,
private videoService: VideoService
) {
// Parent get the video channel for us
this.videoChannelSub = this.videoChannelService.videoChannelLoaded
- .subscribe(videoChannel => {
- this.videoChannel = videoChannel
+ .pipe(first())
+ .subscribe(videoChannel => {
+ this.videoChannel = videoChannel
- this.reloadVideos()
- this.generateSyndicationList()
- })
+ this.reloadVideos()
+ this.generateSyndicationList()
+ })
}
ngOnDestroy () {
return this.videoService
.getVideoChannelVideos(this.videoChannel, newPagination, this.sort)
.pipe(
- tap(({ totalVideos }) => {
- this.titlePage = this.i18n('Published {{totalVideos}} videos', { totalVideos })
+ tap(({ total }) => {
+ this.titlePage = this.i18n(`{total, plural, =1 {Published 1 video} other {Published ${total} videos}}`, { total })
})
)
}