Fixed error for Ratings page and stats page & added controlls to make Rating system and Ratings page optional (admin can turn it on or off for the server)

This commit is contained in:
fannta1990 2026-02-09 10:58:17 +01:00
parent 3a8075a077
commit e4e2770fbd
10 changed files with 128 additions and 49 deletions

View file

@ -103,6 +103,26 @@
<ui-toggle-switch v-model="newServerSettings.allowIframe" :label="$strings.LabelSettingsAllowIframe" :disabled="updatingServerSettings" @input="(val) => updateSettingsKey('allowIframe', val)" />
<p aria-hidden="true" class="pl-4">{{ $strings.LabelSettingsAllowIframe }}</p>
</div>
<div role="article" :aria-label="$strings.LabelSettingsEnableReviewsHelp" class="flex items-center py-2">
<ui-toggle-switch :label="$strings.LabelSettingsEnableReviews" v-model="newServerSettings.enableReviews" :disabled="updatingServerSettings" @input="(val) => updateSettingsKey('enableReviews', val)" />
<ui-tooltip aria-hidden="true" :text="$strings.LabelSettingsEnableReviewsHelp">
<p class="pl-4">
<span id="settings-enable-reviews">{{ $strings.LabelSettingsEnableReviews }}</span>
<span class="material-symbols icon-text">info</span>
</p>
</ui-tooltip>
</div>
<div v-if="newServerSettings.enableReviews" role="article" :aria-label="$strings.LabelSettingsShowRatingsPageHelp" class="flex items-center py-2 mb-2">
<ui-toggle-switch :label="$strings.LabelSettingsShowRatingsPage" v-model="newServerSettings.showReviewsInSidebar" :disabled="updatingServerSettings" @input="(val) => updateSettingsKey('showReviewsInSidebar', val)" />
<ui-tooltip aria-hidden="true" :text="$strings.LabelSettingsShowRatingsPageHelp">
<p class="pl-4">
<span id="settings-show-ratings-page">{{ $strings.LabelSettingsShowRatingsPage }}</span>
<span class="material-symbols icon-text">info</span>
</p>
</ui-tooltip>
</div>
</div>
<div class="flex-1">

View file

@ -128,7 +128,7 @@
<button v-if="isDescriptionClamped" class="py-0.5 flex items-center text-slate-300 hover:text-white" @click="showFullDescription = !showFullDescription">{{ showFullDescription ? $strings.ButtonReadLess : $strings.ButtonReadMore }} <span class="material-symbols text-xl pl-1" v-html="showFullDescription ? 'expand_less' : '&#xe313;'" /></button>
</div>
<tables-reviews-table :library-item="libraryItem" class="mt-6" />
<tables-reviews-table v-if="enableReviews" :library-item="libraryItem" class="mt-6" />
<tables-chapters-table v-if="chapters.length" :library-item="libraryItem" class="mt-6" />
@ -145,7 +145,7 @@
<modals-podcast-episode-feed v-model="showPodcastEpisodeFeed" :library-item="libraryItem" :episodes="podcastFeedEpisodes" :download-queue="episodeDownloadsQueued" :episodes-downloading="episodesDownloading" />
<modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :playback-rate="1" :library-item-id="libraryItemId" hide-create @select="selectBookmark" />
<modals-review-modal />
<modals-review-modal v-if="enableReviews" />
</div>
</template>
@ -346,6 +346,9 @@ export default {
isQueued() {
return this.$store.getters['getIsMediaQueued'](this.libraryItemId)
},
enableReviews() {
return this.$store.getters['getServerSetting']('enableReviews')
},
userCanUpdate() {
return this.$store.getters['user/getUserCanUpdate']
},

View file

@ -43,7 +43,7 @@
</div>
</template>
</div>
<div v-if="isBookLibrary && top10RatedItems.length" class="w-80 my-6 mx-auto">
<div v-if="isBookLibrary && enableReviews && top10RatedItems.length" class="w-80 my-6 mx-auto">
<h1 class="text-2xl mb-4">{{ $strings.HeaderStatsTopRated }}</h1>
<template v-for="(ab, index) in top10RatedItems">
<div :key="index" class="w-full py-2">
@ -188,6 +188,9 @@ export default {
},
isBookLibrary() {
return this.currentLibraryMediaType === 'book'
},
enableReviews() {
return this.$store.getters['getServerSetting']('enableReviews')
}
},
methods: {