fixes after code review

This commit is contained in:
kontrollanten 2022-08-09 14:49:27 +02:00
parent 38c55ffebd
commit 606fd8925e
4 changed files with 4 additions and 11 deletions

View File

@ -37,7 +37,6 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
totalItems: null totalItems: null
} }
miniatureDisplayOptions: MiniatureDisplayOptions = { miniatureDisplayOptions: MiniatureDisplayOptions = {
containedInPlaylists: true,
date: true, date: true,
views: true, views: true,
by: true, by: true,
@ -102,7 +101,7 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
} }
this.getVideosObservable(this.pagination.currentPage) this.getVideosObservable(this.pagination.currentPage)
.pipe(switchMap(({ data }) => this.playlistService.listPlaylistsForVideos(data.map(v => v.id)))) .pipe(switchMap(({ data }) => this.playlistService.doVideosExistInPlaylist(data.map(v => v.id))))
.subscribe(result => { .subscribe(result => {
this.videosContainedInPlaylists = Object.keys(result).reduce((acc, videoId) => ({ this.videosContainedInPlaylists = Object.keys(result).reduce((acc, videoId) => ({
...acc, ...acc,

View File

@ -53,8 +53,8 @@
<ng-container *ngIf="displayOptions.state">{{ getStateLabel(video) }}</ng-container> <ng-container *ngIf="displayOptions.state">{{ getStateLabel(video) }}</ng-container>
</div> </div>
<div *ngIf="displayOptions.containedInPlaylists" class="video-contained-in-playlists"> <div *ngIf="containedInPlaylists" class="video-contained-in-playlists">
<a *ngFor="let playlist of containedInPlaylists" class="chip rectangular bg-secondary text-light" [routerLink]="['/w/p/', playlist.playlistShortUUID]" i18n> <a *ngFor="let playlist of containedInPlaylists" class="chip rectangular bg-secondary text-light" [routerLink]="['/w/p/', playlist.playlistShortUUID]">
{{ playlist.playlistDisplayName }} {{ playlist.playlistDisplayName }}
</a> </a>
</div> </div>

View File

@ -19,7 +19,6 @@ import { VideoPlaylistService } from '../shared-video-playlist'
import { VideoActionsDisplayType } from './video-actions-dropdown.component' import { VideoActionsDisplayType } from './video-actions-dropdown.component'
export type MiniatureDisplayOptions = { export type MiniatureDisplayOptions = {
containedInPlaylists?: boolean
date?: boolean date?: boolean
views?: boolean views?: boolean
by?: boolean by?: boolean
@ -42,7 +41,6 @@ export class VideoMiniatureComponent implements OnInit {
@Input() containedInPlaylists: VideoExistInPlaylist[] @Input() containedInPlaylists: VideoExistInPlaylist[]
@Input() displayOptions: MiniatureDisplayOptions = { @Input() displayOptions: MiniatureDisplayOptions = {
containedInPlaylists: false,
date: true, date: true,
views: true, views: true,
by: true, by: true,

View File

@ -83,10 +83,6 @@ export class VideoPlaylistService {
) )
} }
listPlaylistsForVideos (videoIds: number[]) {
return this.doVideosExistInPlaylist(videoIds)
}
listMyPlaylistWithCache (user: AuthUser, search?: string) { listMyPlaylistWithCache (user: AuthUser, search?: string) {
if (!search) { if (!search) {
if (this.myAccountPlaylistCacheRunning) return this.myAccountPlaylistCacheRunning if (this.myAccountPlaylistCacheRunning) return this.myAccountPlaylistCacheRunning
@ -342,7 +338,7 @@ export class VideoPlaylistService {
) )
} }
private doVideosExistInPlaylist (videoIds: number[]): Observable<VideosExistInPlaylists> { doVideosExistInPlaylist (videoIds: number[]): Observable<VideosExistInPlaylists> {
const url = VideoPlaylistService.MY_VIDEO_PLAYLIST_URL + 'videos-exist' const url = VideoPlaylistService.MY_VIDEO_PLAYLIST_URL + 'videos-exist'
let params = new HttpParams() let params = new HttpParams()