Fix to rate only books

This commit is contained in:
Peter BALIVET 2025-07-01 14:09:37 +02:00
parent 89bd541247
commit 9a94b9b0c3
5 changed files with 13 additions and 8 deletions

View File

@ -248,7 +248,7 @@ export default {
libraryItemUpdated(updatedLibraryItem) {
if (this.libraryItem && this.libraryItem.id === updatedLibraryItem.id) {
// The updated item from the server doesn't contain rating data, so we preserve it from the client-side model.
if (this.libraryItem.media) {
if (this.libraryItem.media && this.mediaType !== 'podcast') {
updatedLibraryItem.media = {
...(updatedLibraryItem.media || {}),
myRating: this.libraryItem.media.myRating,

View File

@ -225,7 +225,7 @@
</div>
</div>
<div v-if="selectedMatchOrig.rating != null" class="flex items-center py-2">
<div v-if="selectedMatchOrig.rating != null && !isPodcast" class="flex items-center py-2">
<ui-checkbox v-model="selectedMatchUsage.rating" checkbox-bg="bg" @input="checkboxToggled" />
<div class="grow ml-4">
<ui-rating-input v-model="selectedMatch.rating" :disabled="!selectedMatchUsage.rating" :label="$strings.LabelRating" />
@ -610,7 +610,7 @@ export default {
}
}
if (this.selectedMatchUsage.rating && this.selectedMatchOrig.rating) {
if (this.selectedMatchUsage.rating && this.selectedMatchOrig.rating && !this.isPodcast) {
updatePayload.provider_data = {
provider: this.provider,
providerId: this.selectedMatchOrig.asin || this.selectedMatchOrig.id,

View File

@ -59,7 +59,7 @@
</div>
<div class="flex flex-wrap mt-2 -mx-1 items-end">
<div class="w-full md:w-1/2 px-1">
<div :class="isPodcast ? 'w-full px-1' : 'w-full md:w-1/2 px-1'">
<div class="flex -mx-1">
<div class="w-1/2 px-1">
<div class="flex justify-center">
@ -73,7 +73,7 @@
</div>
</div>
</div>
<div class="w-full md:w-1/2 px-1 mt-2 md:mt-0">
<div v-if="!isPodcast" class="w-full md:w-1/2 px-1 mt-2 md:mt-0">
<div class="flex justify-center items-center">
<label class="px-1 text-sm font-semibold mr-2">{{ $strings.LabelRating }}</label>
<ui-rating-input v-model="details.rating" @input="handleInputChange" />
@ -128,6 +128,10 @@ export default {
}
},
computed: {
isPodcast() {
if (!this.libraryItem) return false
return this.libraryItem.mediaType === 'podcast'
},
media() {
return this.libraryItem ? this.libraryItem.media || {} : {}
},
@ -259,6 +263,7 @@ export default {
checkForChanges() {
var metadata = {}
for (const key in this.details) {
if (this.isPodcast && key === 'rating') continue
var newValue = this.details[key]
var oldValue = this.mediaMetadata[key]
// Key cleared out or key first populated

View File

@ -48,7 +48,7 @@
<p v-else class="mb-2 mt-0.5 text-gray-200 text-xl">by Unknown</p>
<!-- RATING SECTION -->
<div v-if="serverSettings.enableRating" class="flex items-center space-x-4 mt-2">
<div v-if="serverSettings.enableRating && !isPodcast" class="flex items-center space-x-4 mt-2">
<div class="flex items-center">
<ui-rating-input :value="myRating" :label="$strings.LabelYourRating" @input="updateRating" />
</div>
@ -67,7 +67,7 @@
</div>
<!-- EXPLICIT RATING SECTION -->
<div v-if="serverSettings.enableExplicitRating && isExplicit" class="flex items-center space-x-4 mt-3">
<div v-if="serverSettings.enableExplicitRating && isExplicit && !isPodcast" class="flex items-center space-x-4 mt-3">
<div class="flex items-center">
<ui-rating-input :value="myExplicitRating" :label="$strings.LabelExplicitRating" icon="flame" @input="updateExplicitRating" />
</div>

View File

@ -194,7 +194,7 @@
"HeaderSettingsDisplay": "Display",
"HeaderSettingsExperimental": "Experimental Features",
"HeaderSettingsGeneral": "General",
"HeaderSettingsRatings": "Ratings",
"HeaderSettingsRatings": "Book Ratings",
"HeaderSettingsScanner": "Scanner",
"HeaderSettingsWebClient": "Web Client",
"HeaderSleepTimer": "Sleep Timer",