Fix changing channel/account
This commit is contained in:
parent
798d8d37ee
commit
0f7224b0d1
|
@ -1,4 +1,6 @@
|
|||
<my-videos-list
|
||||
#videosList
|
||||
|
||||
*ngIf="account"
|
||||
|
||||
[title]="title"
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { Subscription } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||
import { ComponentPaginationLight, DisableForReuseHook, ScreenService } from '@app/core'
|
||||
import { VideoSortField } from '@peertube/peertube-models'
|
||||
import { VideosListComponent } from '../../shared/shared-video-miniature/videos-list.component'
|
||||
import { NgIf } from '@angular/common'
|
||||
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'
|
||||
import { ComponentPaginationLight, DisableForReuseHook, ScreenService } from '@app/core'
|
||||
import { Account } from '@app/shared/shared-main/account/account.model'
|
||||
import { AccountService } from '@app/shared/shared-main/account/account.service'
|
||||
import { VideoService } from '@app/shared/shared-main/video/video.service'
|
||||
import { Account } from '@app/shared/shared-main/account/account.model'
|
||||
import { VideoFilters } from '@app/shared/shared-video-miniature/video-filters.model'
|
||||
import { VideoSortField } from '@peertube/peertube-models'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { VideosListComponent } from '../../shared/shared-video-miniature/videos-list.component'
|
||||
|
||||
@Component({
|
||||
selector: 'my-account-videos',
|
||||
|
@ -17,6 +16,8 @@ import { VideoFilters } from '@app/shared/shared-video-miniature/video-filters.m
|
|||
imports: [ NgIf, VideosListComponent ]
|
||||
})
|
||||
export class AccountVideosComponent implements OnInit, OnDestroy, DisableForReuseHook {
|
||||
@ViewChild('videosList') videosList: VideosListComponent
|
||||
|
||||
getVideosObservableFunction = this.getVideosObservable.bind(this)
|
||||
getSyndicationItemsFunction = this.getSyndicationItems.bind(this)
|
||||
|
||||
|
@ -26,6 +27,8 @@ export class AccountVideosComponent implements OnInit, OnDestroy, DisableForReus
|
|||
account: Account
|
||||
disabled = false
|
||||
|
||||
private alreadyLoaded = false
|
||||
|
||||
private accountSub: Subscription
|
||||
|
||||
constructor (
|
||||
|
@ -37,8 +40,13 @@ export class AccountVideosComponent implements OnInit, OnDestroy, DisableForReus
|
|||
|
||||
ngOnInit () {
|
||||
// Parent get the account for us
|
||||
this.accountService.accountLoaded.pipe(first())
|
||||
.subscribe(account => this.account = account)
|
||||
this.accountSub = this.accountService.accountLoaded
|
||||
.subscribe(account => {
|
||||
this.account = account
|
||||
if (this.alreadyLoaded) this.videosList.reloadVideos()
|
||||
|
||||
this.alreadyLoaded = true
|
||||
})
|
||||
}
|
||||
|
||||
ngOnDestroy () {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
<div>
|
||||
<div class="section-label" i18n>ACCOUNT</div>
|
||||
|
||||
<a routerLink="/a/jean">Coucou</a>
|
||||
|
||||
<div class="actor-info">
|
||||
<div>
|
||||
<div class="actor-display-name align-items-center">
|
||||
|
|
|
@ -45,6 +45,8 @@ export class VideoChannelPlaylistsComponent implements OnInit, AfterViewInit, On
|
|||
|
||||
this.hooks.runAction('action:video-channel-playlists.video-channel.loaded', 'video-channel', { videoChannel })
|
||||
|
||||
this.videoPlaylists = []
|
||||
this.pagination.currentPage = 1
|
||||
this.loadVideoPlaylists()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<my-videos-list
|
||||
#videosList
|
||||
|
||||
*ngIf="videoChannel"
|
||||
|
||||
[title]="title"
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import { Subscription } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core'
|
||||
import { ComponentPaginationLight, DisableForReuseHook, HooksService, ScreenService } from '@app/core'
|
||||
import { Video, VideoSortField } from '@peertube/peertube-models'
|
||||
import { VideosListComponent } from '../../shared/shared-video-miniature/videos-list.component'
|
||||
import { NgIf } from '@angular/common'
|
||||
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild, viewChild } from '@angular/core'
|
||||
import { ComponentPaginationLight, DisableForReuseHook, HooksService, ScreenService } from '@app/core'
|
||||
import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model'
|
||||
import { VideoChannelService } from '@app/shared/shared-main/video-channel/video-channel.service'
|
||||
import { VideoService } from '@app/shared/shared-main/video/video.service'
|
||||
import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature/video-miniature.component'
|
||||
import { VideoFilters } from '@app/shared/shared-video-miniature/video-filters.model'
|
||||
import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature/video-miniature.component'
|
||||
import { Video, VideoSortField } from '@peertube/peertube-models'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { VideosListComponent } from '../../shared/shared-video-miniature/videos-list.component'
|
||||
|
||||
@Component({
|
||||
selector: 'my-video-channel-videos',
|
||||
|
@ -18,6 +17,8 @@ import { VideoFilters } from '@app/shared/shared-video-miniature/video-filters.m
|
|||
imports: [ NgIf, VideosListComponent ]
|
||||
})
|
||||
export class VideoChannelVideosComponent implements OnInit, AfterViewInit, OnDestroy, DisableForReuseHook {
|
||||
@ViewChild('videosList') videosList: VideosListComponent
|
||||
|
||||
getVideosObservableFunction = this.getVideosObservable.bind(this)
|
||||
getSyndicationItemsFunction = this.getSyndicationItems.bind(this)
|
||||
|
||||
|
@ -39,6 +40,7 @@ export class VideoChannelVideosComponent implements OnInit, AfterViewInit, OnDes
|
|||
disabled = false
|
||||
|
||||
private videoChannelSub: Subscription
|
||||
private alreadyLoaded = false
|
||||
|
||||
constructor (
|
||||
private screenService: ScreenService,
|
||||
|
@ -50,11 +52,14 @@ export class VideoChannelVideosComponent implements OnInit, AfterViewInit, OnDes
|
|||
|
||||
ngOnInit () {
|
||||
// Parent get the video channel for us
|
||||
this.videoChannelService.videoChannelLoaded.pipe(first())
|
||||
this.videoChannelSub = this.videoChannelService.videoChannelLoaded
|
||||
.subscribe(videoChannel => {
|
||||
this.videoChannel = videoChannel
|
||||
if (this.alreadyLoaded) this.videosList.reloadVideos()
|
||||
|
||||
this.hooks.runAction('action:video-channel-videos.video-channel.loaded', 'video-channel', { videoChannel })
|
||||
|
||||
this.alreadyLoaded = true
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue