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