Fix my-account{videos,video-playlists} loading mecanism
This commit is contained in:
parent
c62a34d36b
commit
9d45db2919
|
@ -48,7 +48,7 @@ export class MyAccountVideoPlaylistsComponent implements OnInit {
|
||||||
.pipe(
|
.pipe(
|
||||||
debounceTime(500))
|
debounceTime(500))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.loadVideoPlaylists()
|
this.loadVideoPlaylists(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,13 +93,13 @@ export class MyAccountVideoPlaylistsComponent implements OnInit {
|
||||||
this.videoPlaylistSearchChanged.next()
|
this.videoPlaylistSearchChanged.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadVideoPlaylists () {
|
private loadVideoPlaylists (reset = false) {
|
||||||
this.authService.userInformationLoaded
|
this.authService.userInformationLoaded
|
||||||
.pipe(flatMap(() => {
|
.pipe(flatMap(() => {
|
||||||
return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
|
return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
|
||||||
}))
|
}))
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
this.videoPlaylists = []
|
if (reset) this.videoPlaylists = []
|
||||||
this.videoPlaylists = this.videoPlaylists.concat(res.data)
|
this.videoPlaylists = this.videoPlaylists.concat(res.data)
|
||||||
this.pagination.totalItems = res.total
|
this.pagination.totalItems = res.total
|
||||||
|
|
||||||
|
|
|
@ -146,11 +146,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
||||||
this.loadMoreVideos()
|
this.loadMoreVideos()
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMoreVideos () {
|
loadMoreVideos (reset = false) {
|
||||||
this.getVideosObservable(this.pagination.currentPage).subscribe(
|
this.getVideosObservable(this.pagination.currentPage).subscribe(
|
||||||
({ data, total }) => {
|
({ data, total }) => {
|
||||||
this.pagination.totalItems = total
|
this.pagination.totalItems = total
|
||||||
this.videos = []
|
if (reset) this.videos = []
|
||||||
this.videos = this.videos.concat(data)
|
this.videos = this.videos.concat(data)
|
||||||
|
|
||||||
if (this.groupByDate) this.buildGroupedDateLabels()
|
if (this.groupByDate) this.buildGroupedDateLabels()
|
||||||
|
@ -171,7 +171,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
||||||
|
|
||||||
reloadVideos () {
|
reloadVideos () {
|
||||||
this.pagination.currentPage = 1
|
this.pagination.currentPage = 1
|
||||||
this.loadMoreVideos()
|
this.loadMoreVideos(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleModerationDisplay () {
|
toggleModerationDisplay () {
|
||||||
|
|
|
@ -132,6 +132,13 @@
|
||||||
font-weight: unset;
|
font-weight: unset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my-video-comment-add {
|
||||||
|
::ng-deep form {
|
||||||
|
margin-top: 1rem;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.children {
|
.children {
|
||||||
|
|
|
@ -187,7 +187,7 @@ $video-info-margin-left: 44px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: 1.3;
|
line-height: 1.37;
|
||||||
|
|
||||||
a:nth-of-type(2) {
|
a:nth-of-type(2) {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { forkJoin, Observable, Subscription } from 'rxjs'
|
||||||
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
|
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
|
||||||
import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
|
import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
|
||||||
import { AuthService, ConfirmService } from '../../core'
|
import { AuthService, ConfirmService } from '../../core'
|
||||||
import { RestExtractor, VideoBlacklistService } from '../../shared'
|
import { RestExtractor } from '../../shared'
|
||||||
import { VideoDetails } from '../../shared/video/video-details.model'
|
import { VideoDetails } from '../../shared/video/video-details.model'
|
||||||
import { VideoService } from '../../shared/video/video.service'
|
import { VideoService } from '../../shared/video/video.service'
|
||||||
import { VideoShareComponent } from './modal/video-share.component'
|
import { VideoShareComponent } from './modal/video-share.component'
|
||||||
|
@ -33,11 +33,10 @@ import { Video } from '@app/shared/video/video.model'
|
||||||
import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'
|
import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'
|
||||||
import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
|
import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
|
||||||
import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
|
import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
|
||||||
import { PluginService } from '@app/core/plugins/plugin.service'
|
|
||||||
import { HooksService } from '@app/core/plugins/hooks.service'
|
import { HooksService } from '@app/core/plugins/hooks.service'
|
||||||
import { PlatformLocation } from '@angular/common'
|
import { PlatformLocation } from '@angular/common'
|
||||||
import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
|
import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
|
||||||
import { scrollToTop, isInViewport, isXPercentInViewport } from '@app/shared/misc/utils'
|
import { scrollToTop, isXPercentInViewport } from '@app/shared/misc/utils'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-watch',
|
selector: 'my-video-watch',
|
||||||
|
@ -93,14 +92,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private videoService: VideoService,
|
private videoService: VideoService,
|
||||||
private playlistService: VideoPlaylistService,
|
private playlistService: VideoPlaylistService,
|
||||||
private videoBlacklistService: VideoBlacklistService,
|
|
||||||
private confirmService: ConfirmService,
|
private confirmService: ConfirmService,
|
||||||
private metaService: MetaService,
|
private metaService: MetaService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private restExtractor: RestExtractor,
|
private restExtractor: RestExtractor,
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
private pluginService: PluginService,
|
|
||||||
private markdownService: MarkdownService,
|
private markdownService: MarkdownService,
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
private redirectService: RedirectService,
|
private redirectService: RedirectService,
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe('Test video playlists API validator', function () {
|
||||||
videoId2 = (await uploadVideoAndGetId({ server, videoName: 'video 2' })).id
|
videoId2 = (await uploadVideoAndGetId({ server, videoName: 'video 2' })).id
|
||||||
|
|
||||||
{
|
{
|
||||||
const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root',0, 5, VideoPlaylistType.WATCH_LATER)
|
const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER)
|
||||||
watchLaterPlaylistId = res.body.data[0].id
|
watchLaterPlaylistId = res.body.data[0].id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue