From 9d45db2919862640ad550c5326fb21ddc08d6d59 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 29 Dec 2019 02:10:17 +0100 Subject: [PATCH] Fix my-account{videos,video-playlists} loading mecanism --- .../my-account-video-playlists.component.ts | 6 +++--- client/src/app/shared/video/abstract-video-list.ts | 6 +++--- .../+video-watch/comment/video-comment.component.scss | 7 +++++++ .../src/app/videos/+video-watch/video-watch.component.scss | 2 +- .../src/app/videos/+video-watch/video-watch.component.ts | 7 ++----- server/tests/api/check-params/video-playlists.ts | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index 42e4782eb..c6728cc30 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts @@ -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 diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 746359851..3e3583a70 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts @@ -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 () { diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.scss b/client/src/app/videos/+video-watch/comment/video-comment.component.scss index cebb24c12..5df5e3ecf 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.scss @@ -132,6 +132,13 @@ font-weight: unset; } } + + my-video-comment-add { + ::ng-deep form { + margin-top: 1rem; + margin-bottom: 0; + } + } } .children { diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index ef0b2d1c5..c92f773e4 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss @@ -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; diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index dcceb1400..9973fad0d 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -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, diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index ae5aa287f..df158f3b1 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts @@ -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 } -- 2.25.1