diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 11:27:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:01:45 +0200 |
commit | 1378c0d343028f3d40d7d795422684ab9e6a1599 (patch) | |
tree | 08062b84a38a7e2dfe0aa674e7ca8e1b7321044e /client/src/app/shared/shared-video-miniature | |
parent | c186a67f90203af6bfa434f026efdc99193bcd65 (diff) | |
download | PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.tar.gz PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.tar.zst PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.zip |
Fix client lint
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
4 files changed, 41 insertions, 38 deletions
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts index 33061a837..d8b2ee17d 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts | |||
@@ -204,28 +204,29 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte | |||
204 | } | 204 | } |
205 | 205 | ||
206 | loadMoreVideos (reset = false) { | 206 | loadMoreVideos (reset = false) { |
207 | this.getVideosObservable(this.pagination.currentPage).subscribe( | 207 | this.getVideosObservable(this.pagination.currentPage) |
208 | ({ data }) => { | 208 | .subscribe({ |
209 | this.hasDoneFirstQuery = true | 209 | next: ({ data }) => { |
210 | this.lastQueryLength = data.length | 210 | this.hasDoneFirstQuery = true |
211 | this.lastQueryLength = data.length | ||
211 | 212 | ||
212 | if (reset) this.videos = [] | 213 | if (reset) this.videos = [] |
213 | this.videos = this.videos.concat(data) | 214 | this.videos = this.videos.concat(data) |
214 | 215 | ||
215 | if (this.groupByDate) this.buildGroupedDateLabels() | 216 | if (this.groupByDate) this.buildGroupedDateLabels() |
216 | 217 | ||
217 | this.onMoreVideos() | 218 | this.onMoreVideos() |
218 | 219 | ||
219 | this.onDataSubject.next(data) | 220 | this.onDataSubject.next(data) |
220 | }, | 221 | }, |
221 | 222 | ||
222 | error => { | 223 | error: err => { |
223 | const message = $localize`Cannot load more videos. Try again later.` | 224 | const message = $localize`Cannot load more videos. Try again later.` |
224 | 225 | ||
225 | console.error(message, { error }) | 226 | console.error(message, { err }) |
226 | this.notifier.error(message) | 227 | this.notifier.error(message) |
227 | } | 228 | } |
228 | ) | 229 | }) |
229 | } | 230 | } |
230 | 231 | ||
231 | reloadVideos () { | 232 | reloadVideos () { |
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 3c2b46d16..2ba091438 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | |||
@@ -183,8 +183,8 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
183 | if (res === false) return | 183 | if (res === false) return |
184 | 184 | ||
185 | this.videoBlocklistService.unblockVideo(this.video.id) | 185 | this.videoBlocklistService.unblockVideo(this.video.id) |
186 | .subscribe( | 186 | .subscribe({ |
187 | () => { | 187 | next: () => { |
188 | this.notifier.success($localize`Video ${this.video.name} unblocked.`) | 188 | this.notifier.success($localize`Video ${this.video.name} unblocked.`) |
189 | 189 | ||
190 | this.video.blacklisted = false | 190 | this.video.blacklisted = false |
@@ -193,8 +193,8 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
193 | this.videoUnblocked.emit() | 193 | this.videoUnblocked.emit() |
194 | }, | 194 | }, |
195 | 195 | ||
196 | err => this.notifier.error(err.message) | 196 | error: err => this.notifier.error(err.message) |
197 | ) | 197 | }) |
198 | } | 198 | } |
199 | 199 | ||
200 | async removeVideo () { | 200 | async removeVideo () { |
@@ -209,40 +209,40 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
209 | if (res === false) return | 209 | if (res === false) return |
210 | 210 | ||
211 | this.videoService.removeVideo(this.video.id) | 211 | this.videoService.removeVideo(this.video.id) |
212 | .subscribe( | 212 | .subscribe({ |
213 | () => { | 213 | next: () => { |
214 | this.notifier.success($localize`Video ${this.video.name} deleted.`) | 214 | this.notifier.success($localize`Video ${this.video.name} deleted.`) |
215 | this.videoRemoved.emit() | 215 | this.videoRemoved.emit() |
216 | }, | 216 | }, |
217 | 217 | ||
218 | error => this.notifier.error(error.message) | 218 | error: err => this.notifier.error(err.message) |
219 | ) | 219 | }) |
220 | } | 220 | } |
221 | 221 | ||
222 | duplicateVideo () { | 222 | duplicateVideo () { |
223 | this.redundancyService.addVideoRedundancy(this.video) | 223 | this.redundancyService.addVideoRedundancy(this.video) |
224 | .subscribe( | 224 | .subscribe({ |
225 | () => { | 225 | next: () => { |
226 | const message = $localize`This video will be duplicated by your instance.` | 226 | const message = $localize`This video will be duplicated by your instance.` |
227 | this.notifier.success(message) | 227 | this.notifier.success(message) |
228 | }, | 228 | }, |
229 | 229 | ||
230 | err => this.notifier.error(err.message) | 230 | error: err => this.notifier.error(err.message) |
231 | ) | 231 | }) |
232 | } | 232 | } |
233 | 233 | ||
234 | muteVideoAccount () { | 234 | muteVideoAccount () { |
235 | const params = { nameWithHost: Actor.CREATE_BY_STRING(this.video.account.name, this.video.account.host) } | 235 | const params = { nameWithHost: Actor.CREATE_BY_STRING(this.video.account.name, this.video.account.host) } |
236 | 236 | ||
237 | this.blocklistService.blockAccountByUser(params) | 237 | this.blocklistService.blockAccountByUser(params) |
238 | .subscribe( | 238 | .subscribe({ |
239 | () => { | 239 | next: () => { |
240 | this.notifier.success($localize`Account ${params.nameWithHost} muted.`) | 240 | this.notifier.success($localize`Account ${params.nameWithHost} muted.`) |
241 | this.videoAccountMuted.emit() | 241 | this.videoAccountMuted.emit() |
242 | }, | 242 | }, |
243 | 243 | ||
244 | err => this.notifier.error(err.message) | 244 | error: err => this.notifier.error(err.message) |
245 | ) | 245 | }) |
246 | } | 246 | } |
247 | 247 | ||
248 | onVideoBlocked () { | 248 | onVideoBlocked () { |
diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts index 355ce8be3..28fefb9dd 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { mapValues, pick } from 'lodash-es' | 1 | import { mapValues, pick } from 'lodash-es' |
2 | import { firstValueFrom } from 'rxjs' | ||
2 | import { tap } from 'rxjs/operators' | 3 | import { tap } from 'rxjs/operators' |
3 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' | 4 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' |
4 | import { AuthService, HooksService, Notifier } from '@app/core' | 5 | import { AuthService, HooksService, Notifier } from '@app/core' |
@@ -265,6 +266,6 @@ export class VideoDownloadComponent { | |||
265 | const observable = this.videoService.getVideoFileMetadata(file.metadataUrl) | 266 | const observable = this.videoService.getVideoFileMetadata(file.metadataUrl) |
266 | .pipe(tap(res => file.metadata = res)) | 267 | .pipe(tap(res => file.metadata = res)) |
267 | 268 | ||
268 | return observable.toPromise() | 269 | return firstValueFrom(observable) |
269 | } | 270 | } |
270 | } | 271 | } |
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index 67e0de6a2..cb81ba3bd 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -214,11 +214,12 @@ export class VideoMiniatureComponent implements OnInit { | |||
214 | addToWatchLater () { | 214 | addToWatchLater () { |
215 | const body = { videoId: this.video.id } | 215 | const body = { videoId: this.video.id } |
216 | 216 | ||
217 | this.videoPlaylistService.addVideoInPlaylist(this.watchLaterPlaylist.id, body).subscribe( | 217 | this.videoPlaylistService.addVideoInPlaylist(this.watchLaterPlaylist.id, body) |
218 | res => { | 218 | .subscribe( |
219 | this.watchLaterPlaylist.playlistElementId = res.videoPlaylistElement.id | 219 | res => { |
220 | } | 220 | this.watchLaterPlaylist.playlistElementId = res.videoPlaylistElement.id |
221 | ) | 221 | } |
222 | ) | ||
222 | } | 223 | } |
223 | 224 | ||
224 | removeFromWatchLater () { | 225 | removeFromWatchLater () { |