mirror of
https://github.com/koel/koel
synced 2024-11-24 05:03:05 +00:00
feat(plus): disable Shareable URL if song is private
This commit is contained in:
parent
44fa2d0179
commit
84ce42da08
2 changed files with 18 additions and 2 deletions
|
@ -262,11 +262,25 @@ new class extends UnitTestCase {
|
|||
expect(screen.queryByText('Edit…')).toBeNull()
|
||||
})
|
||||
|
||||
it('has an option to copy shareable URL', async () => {
|
||||
it('has an option to copy shareable URL in Community edition', async () => {
|
||||
await this.renderComponent(factory<Song>('song'))
|
||||
screen.getByText('Copy Shareable URL')
|
||||
})
|
||||
|
||||
it('has an option to copy shareable URL if song is public in Plus edition', async () => {
|
||||
this.enablePlusEdition()
|
||||
|
||||
await this.renderComponent(factory<Song>('song', { is_public: true }))
|
||||
screen.getByText('Copy Shareable URL')
|
||||
})
|
||||
|
||||
it('does not have an option to share if song is private in Plus edition', async () => {
|
||||
this.enablePlusEdition()
|
||||
|
||||
await this.renderComponent(factory<Song>('song', { is_public: false }))
|
||||
expect(screen.queryByText('Copy Shareable URL')).toBeNull()
|
||||
})
|
||||
|
||||
it('deletes song', async () => {
|
||||
const confirmMock = this.mock(DialogBoxStub.value, 'confirm', true)
|
||||
const toasterMock = this.mock(MessageToasterStub.value, 'success')
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<li v-if="canModify" @click="openEditForm">Edit…</li>
|
||||
<li v-if="allowsDownload" @click="download">Download</li>
|
||||
<li v-if="onlyOneSongSelected" @click="copyUrl">Copy Shareable URL</li>
|
||||
<li v-if="onlyOneSongSelected && canBeShared" @click="copyUrl">Copy Shareable URL</li>
|
||||
|
||||
<template v-if="canBeRemovedFromPlaylist">
|
||||
<li class="separator" />
|
||||
|
@ -123,6 +123,8 @@ const makePrivate = () => trigger(async () => {
|
|||
toastSuccess(`Removed public access to ${pluralize(songs.value, 'song')}.`)
|
||||
})
|
||||
|
||||
const canBeShared = computed(() => !isPlus.value || songs.value[0].is_public)
|
||||
|
||||
const visibilityActions = computed(() => {
|
||||
if (!isPlus.value) return []
|
||||
|
||||
|
|
Loading…
Reference in a new issue