From a86c2ab654bc38d5224f200e8e9516db410cfd1b Mon Sep 17 00:00:00 2001 From: Phan An Date: Thu, 31 Oct 2024 17:55:09 +0700 Subject: [PATCH] fix: options to mark songs as private/public shown in Community edition (#1870) --- .../assets/js/components/song/PlayableContextMenu.spec.ts | 6 ++++++ resources/assets/js/components/song/PlayableContextMenu.vue | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/resources/assets/js/components/song/PlayableContextMenu.spec.ts b/resources/assets/js/components/song/PlayableContextMenu.spec.ts index 9977f9dd..da27aacc 100644 --- a/resources/assets/js/components/song/PlayableContextMenu.spec.ts +++ b/resources/assets/js/components/song/PlayableContextMenu.spec.ts @@ -305,6 +305,12 @@ new class extends UnitTestCase { expect(emitMock).toHaveBeenCalledWith('MODAL_SHOW_CREATE_PLAYLIST_FORM', null, playables) }) + it('does not have the options to mark song as private or public in Community edition', async () => { + await this.renderComponent(factory('song')) + expect(screen.queryByText('Mark as Private')).toBeNull() + expect(screen.queryByText('Unmark as Private')).toBeNull() + }) + it('makes songs private', async () => { this.enablePlusEdition() diff --git a/resources/assets/js/components/song/PlayableContextMenu.vue b/resources/assets/js/components/song/PlayableContextMenu.vue index ded0650e..b6b44615 100644 --- a/resources/assets/js/components/song/PlayableContextMenu.vue +++ b/resources/assets/js/components/song/PlayableContextMenu.vue @@ -167,6 +167,10 @@ const visibilityActions = computed(() => { return [] } + if (!isPlus.value) { + return [] + } + const visibilities = Array.from(new Set((playables.value as Song[]).map(song => song.is_public ? 'public' : 'private',