diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-29 02:10:17 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-29 02:10:17 +0100 |
commit | 9d45db2919862640ad550c5326fb21ddc08d6d59 (patch) | |
tree | cfc6780f1180cd40536e0cdd8ad4383675475f42 | |
parent | c62a34d36bf498cb81c6611e58079535325b92d8 (diff) | |
download | PeerTube-9d45db2919862640ad550c5326fb21ddc08d6d59.tar.gz PeerTube-9d45db2919862640ad550c5326fb21ddc08d6d59.tar.zst PeerTube-9d45db2919862640ad550c5326fb21ddc08d6d59.zip |
Fix my-account{videos,video-playlists} loading mecanism
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' | |||
10 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 10 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
11 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' | 11 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' |
12 | import { AuthService, ConfirmService } from '../../core' | 12 | import { AuthService, ConfirmService } from '../../core' |
13 | import { RestExtractor, VideoBlacklistService } from '../../shared' | 13 | import { RestExtractor } from '../../shared' |
14 | import { VideoDetails } from '../../shared/video/video-details.model' | 14 | import { VideoDetails } from '../../shared/video/video-details.model' |
15 | import { VideoService } from '../../shared/video/video.service' | 15 | import { VideoService } from '../../shared/video/video.service' |
16 | import { VideoShareComponent } from './modal/video-share.component' | 16 | import { VideoShareComponent } from './modal/video-share.component' |
@@ -33,11 +33,10 @@ import { Video } from '@app/shared/video/video.model' | |||
33 | import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' | 33 | import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' |
34 | import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' | 34 | import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' |
35 | import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage' | 35 | import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage' |
36 | import { PluginService } from '@app/core/plugins/plugin.service' | ||
37 | import { HooksService } from '@app/core/plugins/hooks.service' | 36 | import { HooksService } from '@app/core/plugins/hooks.service' |
38 | import { PlatformLocation } from '@angular/common' | 37 | import { PlatformLocation } from '@angular/common' |
39 | import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component' | 38 | import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component' |
40 | import { scrollToTop, isInViewport, isXPercentInViewport } from '@app/shared/misc/utils' | 39 | import { 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 | ||