{{ $strings.LabelSettingsEnableCommunityRating }} @@ -279,6 +279,12 @@ export default { } }, watch: { + communityRatingDisabled(isDisabled) { + if (isDisabled && this.newServerSettings.enableCommunityRating) { + this.newServerSettings.enableCommunityRating = false + this.updateSettingsKey('enableCommunityRating', false) + } + }, serverSettings(newVal, oldVal) { if (newVal && !oldVal) { this.initServerSettings() @@ -286,6 +292,9 @@ export default { } }, computed: { + communityRatingDisabled() { + return !this.newServerSettings.enableRating && !this.newServerSettings.enableExplicitRating + }, serverSettings() { return this.$store.state.serverSettings }, diff --git a/server/migrations/v2.25.2-add-book-ratings.js b/server/migrations/v2.25.2-add-book-ratings.js index d4f517e5c..1d15d545a 100644 --- a/server/migrations/v2.25.2-add-book-ratings.js +++ b/server/migrations/v2.25.2-add-book-ratings.js @@ -4,14 +4,6 @@ module.exports = { up: async ({ context: queryInterface }) => { const transaction = await queryInterface.sequelize.transaction() try { - await queryInterface.addColumn( - 'books', - 'rating', - { - type: DataTypes.FLOAT - }, - { transaction } - ) await queryInterface.addColumn( 'books', 'providerRating', @@ -45,7 +37,6 @@ module.exports = { down: async ({ context: queryInterface }) => { const transaction = await queryInterface.sequelize.transaction() try { - await queryInterface.removeColumn('books', 'rating', { transaction }) await queryInterface.removeColumn('books', 'providerRating', { transaction }) await queryInterface.removeColumn('books', 'provider', { transaction }) await queryInterface.removeColumn('books', 'providerId', { transaction }) diff --git a/server/models/Book.js b/server/models/Book.js index 86b0e994b..56777be02 100644 --- a/server/models/Book.js +++ b/server/models/Book.js @@ -131,8 +131,6 @@ class Book extends Model { /** @type {import('./Series')[]} - optional if expanded */ this.series - /** @type {number} */ - this.rating /** @type {number} */ this.providerRating /** @type {string} */ @@ -168,7 +166,6 @@ class Book extends Model { coverPath: DataTypes.STRING, duration: DataTypes.FLOAT, - rating: DataTypes.FLOAT, providerRating: DataTypes.FLOAT, provider: DataTypes.STRING, providerId: DataTypes.STRING, @@ -372,7 +369,7 @@ class Book extends Model { language: this.language, explicit: !!this.explicit, abridged: !!this.abridged, - rating: this.rating + rating: this.providerRating } } @@ -420,8 +417,8 @@ class Book extends Model { this.abridged = !!payload.metadata.abridged hasUpdates = true } - if (payload.metadata.rating !== undefined && this.rating !== payload.metadata.rating) { - this.rating = payload.metadata.rating + if (payload.metadata.rating !== undefined && this.providerRating !== payload.metadata.rating) { + this.providerRating = payload.metadata.rating hasUpdates = true } const arrayOfStringsKeys = ['narrators', 'genres'] @@ -604,7 +601,7 @@ class Book extends Model { language: this.language, explicit: this.explicit, abridged: this.abridged, - rating: this.rating + rating: this.providerRating } } @@ -627,7 +624,7 @@ class Book extends Model { language: this.language, explicit: this.explicit, abridged: this.abridged, - rating: this.rating + rating: this.providerRating } } @@ -639,7 +636,7 @@ class Book extends Model { oldMetadataJSON.narratorName = (this.narrators || []).join(', ') oldMetadataJSON.seriesName = this.seriesName oldMetadataJSON.descriptionPlain = this.description ? htmlSanitizer.stripAllTags(this.description) : null - oldMetadataJSON.rating = this.rating + oldMetadataJSON.rating = this.providerRating return oldMetadataJSON }