aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2019-12-29 02:10:17 +0100
committerRigel Kent <sendmemail@rigelk.eu>2019-12-29 02:10:17 +0100
commit9d45db2919862640ad550c5326fb21ddc08d6d59 (patch)
treecfc6780f1180cd40536e0cdd8ad4383675475f42
parentc62a34d36bf498cb81c6611e58079535325b92d8 (diff)
downloadPeerTube-9d45db2919862640ad550c5326fb21ddc08d6d59.tar.gz
PeerTube-9d45db2919862640ad550c5326fb21ddc08d6d59.tar.zst
PeerTube-9d45db2919862640ad550c5326fb21ddc08d6d59.zip
Fix my-account{videos,video-playlists} loading mecanism
-rw-r--r--client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts6
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts6
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.scss7
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.scss2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts7
-rw-r--r--server/tests/api/check-params/video-playlists.ts2
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 {
48 .pipe( 48 .pipe(
49 debounceTime(500)) 49 debounceTime(500))
50 .subscribe(() => { 50 .subscribe(() => {
51 this.loadVideoPlaylists() 51 this.loadVideoPlaylists(true)
52 }) 52 })
53 } 53 }
54 54
@@ -93,13 +93,13 @@ export class MyAccountVideoPlaylistsComponent implements OnInit {
93 this.videoPlaylistSearchChanged.next() 93 this.videoPlaylistSearchChanged.next()
94 } 94 }
95 95
96 private loadVideoPlaylists () { 96 private loadVideoPlaylists (reset = false) {
97 this.authService.userInformationLoaded 97 this.authService.userInformationLoaded
98 .pipe(flatMap(() => { 98 .pipe(flatMap(() => {
99 return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch) 99 return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch)
100 })) 100 }))
101 .subscribe(res => { 101 .subscribe(res => {
102 this.videoPlaylists = [] 102 if (reset) this.videoPlaylists = []
103 this.videoPlaylists = this.videoPlaylists.concat(res.data) 103 this.videoPlaylists = this.videoPlaylists.concat(res.data)
104 this.pagination.totalItems = res.total 104 this.pagination.totalItems = res.total
105 105
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
146 this.loadMoreVideos() 146 this.loadMoreVideos()
147 } 147 }
148 148
149 loadMoreVideos () { 149 loadMoreVideos (reset = false) {
150 this.getVideosObservable(this.pagination.currentPage).subscribe( 150 this.getVideosObservable(this.pagination.currentPage).subscribe(
151 ({ data, total }) => { 151 ({ data, total }) => {
152 this.pagination.totalItems = total 152 this.pagination.totalItems = total
153 this.videos = [] 153 if (reset) this.videos = []
154 this.videos = this.videos.concat(data) 154 this.videos = this.videos.concat(data)
155 155
156 if (this.groupByDate) this.buildGroupedDateLabels() 156 if (this.groupByDate) this.buildGroupedDateLabels()
@@ -171,7 +171,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
171 171
172 reloadVideos () { 172 reloadVideos () {
173 this.pagination.currentPage = 1 173 this.pagination.currentPage = 1
174 this.loadMoreVideos() 174 this.loadMoreVideos(true)
175 } 175 }
176 176
177 toggleModerationDisplay () { 177 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 @@
132 font-weight: unset; 132 font-weight: unset;
133 } 133 }
134 } 134 }
135
136 my-video-comment-add {
137 ::ng-deep form {
138 margin-top: 1rem;
139 margin-bottom: 0;
140 }
141 }
135 } 142 }
136 143
137 .children { 144 .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;
187 display: flex; 187 display: flex;
188 flex-direction: column; 188 flex-direction: column;
189 position: relative; 189 position: relative;
190 line-height: 1.3; 190 line-height: 1.37;
191 191
192 a:nth-of-type(2) { 192 a:nth-of-type(2) {
193 font-weight: 500; 193 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'
10import { Hotkey, HotkeysService } from 'angular2-hotkeys' 10import { Hotkey, HotkeysService } from 'angular2-hotkeys'
11import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' 11import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
12import { AuthService, ConfirmService } from '../../core' 12import { AuthService, ConfirmService } from '../../core'
13import { RestExtractor, VideoBlacklistService } from '../../shared' 13import { RestExtractor } from '../../shared'
14import { VideoDetails } from '../../shared/video/video-details.model' 14import { VideoDetails } from '../../shared/video/video-details.model'
15import { VideoService } from '../../shared/video/video.service' 15import { VideoService } from '../../shared/video/video.service'
16import { VideoShareComponent } from './modal/video-share.component' 16import { VideoShareComponent } from './modal/video-share.component'
@@ -33,11 +33,10 @@ import { Video } from '@app/shared/video/video.model'
33import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' 33import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'
34import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' 34import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
35import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage' 35import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
36import { PluginService } from '@app/core/plugins/plugin.service'
37import { HooksService } from '@app/core/plugins/hooks.service' 36import { HooksService } from '@app/core/plugins/hooks.service'
38import { PlatformLocation } from '@angular/common' 37import { PlatformLocation } from '@angular/common'
39import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component' 38import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
40import { scrollToTop, isInViewport, isXPercentInViewport } from '@app/shared/misc/utils' 39import { scrollToTop, isXPercentInViewport } from '@app/shared/misc/utils'
41 40
42@Component({ 41@Component({
43 selector: 'my-video-watch', 42 selector: 'my-video-watch',
@@ -93,14 +92,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
93 private router: Router, 92 private router: Router,
94 private videoService: VideoService, 93 private videoService: VideoService,
95 private playlistService: VideoPlaylistService, 94 private playlistService: VideoPlaylistService,
96 private videoBlacklistService: VideoBlacklistService,
97 private confirmService: ConfirmService, 95 private confirmService: ConfirmService,
98 private metaService: MetaService, 96 private metaService: MetaService,
99 private authService: AuthService, 97 private authService: AuthService,
100 private serverService: ServerService, 98 private serverService: ServerService,
101 private restExtractor: RestExtractor, 99 private restExtractor: RestExtractor,
102 private notifier: Notifier, 100 private notifier: Notifier,
103 private pluginService: PluginService,
104 private markdownService: MarkdownService, 101 private markdownService: MarkdownService,
105 private zone: NgZone, 102 private zone: NgZone,
106 private redirectService: RedirectService, 103 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 () {
54 videoId2 = (await uploadVideoAndGetId({ server, videoName: 'video 2' })).id 54 videoId2 = (await uploadVideoAndGetId({ server, videoName: 'video 2' })).id
55 55
56 { 56 {
57 const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root',0, 5, VideoPlaylistType.WATCH_LATER) 57 const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER)
58 watchLaterPlaylistId = res.body.data[0].id 58 watchLaterPlaylistId = res.body.data[0].id
59 } 59 }
60 60