Fix my-account{videos,video-playlists} loading mecanism
authorRigel Kent <sendmemail@rigelk.eu>
Sun, 29 Dec 2019 01:10:17 +0000 (02:10 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Sun, 29 Dec 2019 01:10:17 +0000 (02:10 +0100)
client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts
client/src/app/shared/video/abstract-video-list.ts
client/src/app/videos/+video-watch/comment/video-comment.component.scss
client/src/app/videos/+video-watch/video-watch.component.scss
client/src/app/videos/+video-watch/video-watch.component.ts
server/tests/api/check-params/video-playlists.ts

index 42e4782eb63887ef89e28089d868b18b50714231..c6728cc3001158b9c089c9c08705b77db2c8c883 100644 (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
 
index 7463598514951c267b00fe67ba9056c7faf7c6da..3e3583a70c049c1311dd5b8d25328e9edb31c51a 100644 (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 () {
index cebb24c12353673bc294b12e6336702072057cbe..5df5e3ecf07645337274b0ba2ead9c272dc2b553 100644 (file)
         font-weight: unset;
       }
     }
+
+    my-video-comment-add {
+      ::ng-deep form {
+        margin-top: 1rem;
+        margin-bottom: 0;
+      }
+    }
   }
 
   .children {
index ef0b2d1c5841276e3789b3ea0a06386c6e8b748d..c92f773e44e5af1c035ff3e8b5f8c6e9882f21d8 100644 (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;
index dcceb140089e997c8d0fa12b48406b9ba1d22ed6..9973fad0d88cfbf1e8ac1c8278586aa51d989d20 100644 (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,
index ae5aa287fb9ac978fa496aa7a55add6e69b16340..df158f3b1c8f0f412cb2c19bf8ef6671376d6411 100644 (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
     }