Fix playlists with unauthenticated users
authorChocobozzz <me@florianbigard.com>
Mon, 13 May 2019 09:25:13 +0000 (11:25 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 13 May 2019 09:25:13 +0000 (11:25 +0200)
client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts
client/src/app/videos/+video-watch/video-watch-playlist.component.ts

index f878a5a24607c82392968756d6f06bffc63d63ad..907aefae13136256ed6d55eb9761e27034627b18 100644 (file)
@@ -1,9 +1,7 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
-import { AuthService } from '../../core/auth'
 import { ConfirmService } from '../../core/confirm'
 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
-import { flatMap } from 'rxjs/operators'
 import { Subscription } from 'rxjs'
 import { Notifier } from '@app/core'
 import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
@@ -28,7 +26,6 @@ export class VideoChannelPlaylistsComponent implements OnInit, OnDestroy {
   private videoChannel: VideoChannel
 
   constructor (
-    private authService: AuthService,
     private notifier: Notifier,
     private confirmService: ConfirmService,
     private videoPlaylistService: VideoPlaylistService,
@@ -57,8 +54,7 @@ export class VideoChannelPlaylistsComponent implements OnInit, OnDestroy {
   }
 
   private loadVideoPlaylists () {
-    this.authService.userInformationLoaded
-        .pipe(flatMap(() => this.videoPlaylistService.listChannelPlaylists(this.videoChannel)))
+    this.videoPlaylistService.listChannelPlaylists(this.videoChannel)
         .subscribe(res => {
           this.videoPlaylists = this.videoPlaylists.concat(res.data)
           this.pagination.totalItems = res.total
index 3ac06c099a1db96e6e6ba50ec598287109fd72a1..bccdaf7b20d779feaf993b0ba02277f2598fa993 100644 (file)
@@ -47,7 +47,9 @@ export class VideoWatchPlaylistComponent {
   }
 
   isPlaylistOwned () {
-    return this.playlist.isLocal === true && this.playlist.ownerAccount.name === this.auth.getUser().username
+    return this.playlist.isLocal === true &&
+      this.auth.isLoggedIn() &&
+      this.playlist.ownerAccount.name === this.auth.getUser().username
   }
 
   isUnlistedPlaylist () {