mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-05 13:46:21 +02:00
provider rating editable + fix config settings
This commit is contained in:
parent
dba575761e
commit
ab00b306e2
@ -57,7 +57,7 @@
|
||||
</div>
|
||||
|
||||
<div role="article" :aria-label="$strings.LabelSettingsEnableCommunityRatingHelp" class="flex items-center py-2">
|
||||
<ui-toggle-switch :label="$strings.LabelSettingsEnableCommunityRating" v-model="newServerSettings.enableCommunityRating" :disabled="updatingServerSettings" @input="(val) => updateSettingsKey('enableCommunityRating', val)" />
|
||||
<ui-toggle-switch :label="$strings.LabelSettingsEnableCommunityRating" v-model="newServerSettings.enableCommunityRating" :disabled="updatingServerSettings || communityRatingDisabled" @input="(val) => updateSettingsKey('enableCommunityRating', val)" />
|
||||
<ui-tooltip aria-hidden="true" :text="$strings.LabelSettingsEnableCommunityRatingHelp">
|
||||
<p class="pl-4">
|
||||
<span id="settings-enable-community-rating">{{ $strings.LabelSettingsEnableCommunityRating }}</span>
|
||||
@ -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
|
||||
},
|
||||
|
@ -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 })
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user