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(
|
||||
debounceTime(500))
|
||||
.subscribe(() => {
|
||||
this.loadVideoPlaylists()
|
||||
this.loadVideoPlaylists(true)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -93,13 +93,13 @@ export class MyAccountVideoPlaylistsComponent implements OnInit {
|
|||
this.videoPlaylistSearchChanged.next()
|
||||
}
|
||||
|
||||
private loadVideoPlaylists () {
|
||||
private loadVideoPlaylists (reset = false) {
|
||||
this.authService.userInformationLoaded
|
||||
.pipe(flatMap(() => {
|
||||
return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
|
||||
}))
|
||||
.subscribe(res => {
|
||||
this.videoPlaylists = []
|
||||
if (reset) this.videoPlaylists = []
|
||||
this.videoPlaylists = this.videoPlaylists.concat(res.data)
|
||||
this.pagination.totalItems = res.total
|
||||
|
||||
|
|
|
@ -146,11 +146,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
|||
this.loadMoreVideos()
|
||||
}
|
||||
|
||||
loadMoreVideos () {
|
||||
loadMoreVideos (reset = false) {
|
||||
this.getVideosObservable(this.pagination.currentPage).subscribe(
|
||||
({ data, total }) => {
|
||||
this.pagination.totalItems = total
|
||||
this.videos = []
|
||||
if (reset) this.videos = []
|
||||
this.videos = this.videos.concat(data)
|
||||
|
||||
if (this.groupByDate) this.buildGroupedDateLabels()
|
||||
|
@ -171,7 +171,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
|
|||
|
||||
reloadVideos () {
|
||||
this.pagination.currentPage = 1
|
||||
this.loadMoreVideos()
|
||||
this.loadMoreVideos(true)
|
||||
}
|
||||
|
||||
toggleModerationDisplay () {
|
||||
|
|
|
@ -132,6 +132,13 @@
|
|||
font-weight: unset;
|
||||
}
|
||||
}
|
||||
|
||||
my-video-comment-add {
|
||||
::ng-deep form {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.children {
|
||||
|
|
|
@ -187,7 +187,7 @@ $video-info-margin-left: 44px;
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
line-height: 1.3;
|
||||
line-height: 1.37;
|
||||
|
||||
a:nth-of-type(2) {
|
||||
font-weight: 500;
|
||||
|
|
|
@ -10,7 +10,7 @@ import { forkJoin, Observable, Subscription } from 'rxjs'
|
|||
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
|
||||
import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
|
||||
import { AuthService, ConfirmService } from '../../core'
|
||||
import { RestExtractor, VideoBlacklistService } from '../../shared'
|
||||
import { RestExtractor } from '../../shared'
|
||||
import { VideoDetails } from '../../shared/video/video-details.model'
|
||||
import { VideoService } from '../../shared/video/video.service'
|
||||
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 { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
|
||||
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 { PlatformLocation } from '@angular/common'
|
||||
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({
|
||||
selector: 'my-video-watch',
|
||||
|
@ -93,14 +92,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
|||
private router: Router,
|
||||
private videoService: VideoService,
|
||||
private playlistService: VideoPlaylistService,
|
||||
private videoBlacklistService: VideoBlacklistService,
|
||||
private confirmService: ConfirmService,
|
||||
private metaService: MetaService,
|
||||
private authService: AuthService,
|
||||
private serverService: ServerService,
|
||||
private restExtractor: RestExtractor,
|
||||
private notifier: Notifier,
|
||||
private pluginService: PluginService,
|
||||
private markdownService: MarkdownService,
|
||||
private zone: NgZone,
|
||||
private redirectService: RedirectService,
|
||||
|
|
|
@ -54,7 +54,7 @@ describe('Test video playlists API validator', function () {
|
|||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue