1
0
Fork 0

Fix my-account{videos,video-playlists} loading mecanism

This commit is contained in:
Rigel Kent 2019-12-29 02:10:17 +01:00
parent c62a34d36b
commit 9d45db2919
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
6 changed files with 17 additions and 13 deletions

View File

@ -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

View File

@ -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 () {

View File

@ -132,6 +132,13 @@
font-weight: unset;
}
}
my-video-comment-add {
::ng-deep form {
margin-top: 1rem;
margin-bottom: 0;
}
}
}
.children {

View File

@ -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;

View File

@ -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,

View File

@ -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
}