From 86cf7a8984004810ed6d7d04d11c37ab618f85ba Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sun, 19 Aug 2018 18:28:30 +0200
Subject: [PATCH] Fix #488: Display public playlists properly for anonymous
 users

---
 changes/changelog.d/488.bugfix       | 1 +
 front/src/views/playlists/Detail.vue | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 changes/changelog.d/488.bugfix

diff --git a/changes/changelog.d/488.bugfix b/changes/changelog.d/488.bugfix
new file mode 100644
index 00000000..a670ee74
--- /dev/null
+++ b/changes/changelog.d/488.bugfix
@@ -0,0 +1 @@
+Display public playlists properly for anonymous users (#488)
diff --git a/front/src/views/playlists/Detail.vue b/front/src/views/playlists/Detail.vue
index f9d23277..5e69f4dd 100644
--- a/front/src/views/playlists/Detail.vue
+++ b/front/src/views/playlists/Detail.vue
@@ -24,13 +24,13 @@
         <play-button class="orange" :tracks="tracks"><translate>Play all</translate></play-button>
         <button
           class="ui icon button"
-          v-if="playlist.user.id === $store.state.auth.profile.id"
+          v-if="$store.state.auth.profile && playlist.user.id === $store.state.auth.profile.id"
           @click="edit = !edit">
           <i class="pencil icon"></i>
           <template v-if="edit"><translate>End edition</translate></template>
           <template v-else><translate>Edit...</translate></template>
         </button>
-        <dangerous-button v-if="playlist.user.id === $store.state.auth.profile.id" class="labeled icon" :action="deletePlaylist">
+        <dangerous-button v-if="$store.state.auth.profile && playlist.user.id === $store.state.auth.profile.id" class="labeled icon" :action="deletePlaylist">
           <i class="trash icon"></i> <translate>Delete</translate>
           <p slot="modal-header">
             <translate :translate-params="{playlist: playlist.name}">Do you want to delete the playlist "%{ playlist }"?</translate>
-- 
GitLab