Fix:Hide download button if user does not have download permission #189

This commit is contained in:
advplyr 2022-05-22 15:49:42 -05:00
parent cb6cb5f637
commit 236fd09c94
4 changed files with 14 additions and 8 deletions

View file

@ -49,7 +49,7 @@
<span class="material-icons">auto_stories</span>
<span v-if="!showPlay" class="px-2 text-base">Read {{ ebookFormat }}</span>
</ui-btn>
<ui-btn v-if="user && showPlay && !hasLocal" :color="downloadItem ? 'warning' : 'primary'" class="flex items-center justify-center mr-2" :padding-x="2" @click="downloadClick">
<ui-btn v-if="showDownload" :color="downloadItem ? 'warning' : 'primary'" class="flex items-center justify-center mr-2" :padding-x="2" @click="downloadClick">
<span class="material-icons" :class="downloadItem ? 'animate-pulse' : ''">{{ downloadItem ? 'downloading' : 'download' }}</span>
</ui-btn>
<ui-read-icon-btn v-if="!isPodcast" :disabled="isProcessingReadUpdate" :is-read="userIsFinished" class="flex items-center justify-center" @click="toggleFinished" />
@ -117,6 +117,9 @@ export default {
isIos() {
return this.$platform === 'ios'
},
userCanDownload() {
return this.$store.getters['user/getUserCanDownload']
},
isLocal() {
return this.libraryItem.isLocal
},
@ -235,6 +238,9 @@ export default {
showRead() {
return this.ebookFile && this.ebookFormat !== 'pdf'
},
showDownload() {
return this.user && this.userCanDownload && this.showPlay && !this.hasLocal
},
ebookFile() {
return this.media.ebookFile
},
@ -242,9 +248,6 @@ export default {
if (!this.ebookFile) return null
return this.ebookFile.ebookFormat
},
hasStoragePermission() {
return this.$store.state.hasStoragePermission
},
downloadItem() {
return this.$store.getters['globals/getDownloadItem'](this.libraryItemId)
},