mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-09 13:50:42 +02:00
provider rating editable + fix config settings
This commit is contained in:
parent
dba575761e
commit
ab00b306e2
@ -57,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div role="article" :aria-label="$strings.LabelSettingsEnableCommunityRatingHelp" class="flex items-center py-2">
|
<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">
|
<ui-tooltip aria-hidden="true" :text="$strings.LabelSettingsEnableCommunityRatingHelp">
|
||||||
<p class="pl-4">
|
<p class="pl-4">
|
||||||
<span id="settings-enable-community-rating">{{ $strings.LabelSettingsEnableCommunityRating }}</span>
|
<span id="settings-enable-community-rating">{{ $strings.LabelSettingsEnableCommunityRating }}</span>
|
||||||
@ -279,6 +279,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
communityRatingDisabled(isDisabled) {
|
||||||
|
if (isDisabled && this.newServerSettings.enableCommunityRating) {
|
||||||
|
this.newServerSettings.enableCommunityRating = false
|
||||||
|
this.updateSettingsKey('enableCommunityRating', false)
|
||||||
|
}
|
||||||
|
},
|
||||||
serverSettings(newVal, oldVal) {
|
serverSettings(newVal, oldVal) {
|
||||||
if (newVal && !oldVal) {
|
if (newVal && !oldVal) {
|
||||||
this.initServerSettings()
|
this.initServerSettings()
|
||||||
@ -286,6 +292,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
communityRatingDisabled() {
|
||||||
|
return !this.newServerSettings.enableRating && !this.newServerSettings.enableExplicitRating
|
||||||
|
},
|
||||||
serverSettings() {
|
serverSettings() {
|
||||||
return this.$store.state.serverSettings
|
return this.$store.state.serverSettings
|
||||||
},
|
},
|
||||||
|
@ -4,14 +4,6 @@ module.exports = {
|
|||||||
up: async ({ context: queryInterface }) => {
|
up: async ({ context: queryInterface }) => {
|
||||||
const transaction = await queryInterface.sequelize.transaction()
|
const transaction = await queryInterface.sequelize.transaction()
|
||||||
try {
|
try {
|
||||||
await queryInterface.addColumn(
|
|
||||||
'books',
|
|
||||||
'rating',
|
|
||||||
{
|
|
||||||
type: DataTypes.FLOAT
|
|
||||||
},
|
|
||||||
{ transaction }
|
|
||||||
)
|
|
||||||
await queryInterface.addColumn(
|
await queryInterface.addColumn(
|
||||||
'books',
|
'books',
|
||||||
'providerRating',
|
'providerRating',
|
||||||
@ -45,7 +37,6 @@ module.exports = {
|
|||||||
down: async ({ context: queryInterface }) => {
|
down: async ({ context: queryInterface }) => {
|
||||||
const transaction = await queryInterface.sequelize.transaction()
|
const transaction = await queryInterface.sequelize.transaction()
|
||||||
try {
|
try {
|
||||||
await queryInterface.removeColumn('books', 'rating', { transaction })
|
|
||||||
await queryInterface.removeColumn('books', 'providerRating', { transaction })
|
await queryInterface.removeColumn('books', 'providerRating', { transaction })
|
||||||
await queryInterface.removeColumn('books', 'provider', { transaction })
|
await queryInterface.removeColumn('books', 'provider', { transaction })
|
||||||
await queryInterface.removeColumn('books', 'providerId', { transaction })
|
await queryInterface.removeColumn('books', 'providerId', { transaction })
|
||||||
|
@ -131,8 +131,6 @@ class Book extends Model {
|
|||||||
/** @type {import('./Series')[]} - optional if expanded */
|
/** @type {import('./Series')[]} - optional if expanded */
|
||||||
this.series
|
this.series
|
||||||
|
|
||||||
/** @type {number} */
|
|
||||||
this.rating
|
|
||||||
/** @type {number} */
|
/** @type {number} */
|
||||||
this.providerRating
|
this.providerRating
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
@ -168,7 +166,6 @@ class Book extends Model {
|
|||||||
coverPath: DataTypes.STRING,
|
coverPath: DataTypes.STRING,
|
||||||
duration: DataTypes.FLOAT,
|
duration: DataTypes.FLOAT,
|
||||||
|
|
||||||
rating: DataTypes.FLOAT,
|
|
||||||
providerRating: DataTypes.FLOAT,
|
providerRating: DataTypes.FLOAT,
|
||||||
provider: DataTypes.STRING,
|
provider: DataTypes.STRING,
|
||||||
providerId: DataTypes.STRING,
|
providerId: DataTypes.STRING,
|
||||||
@ -372,7 +369,7 @@ class Book extends Model {
|
|||||||
language: this.language,
|
language: this.language,
|
||||||
explicit: !!this.explicit,
|
explicit: !!this.explicit,
|
||||||
abridged: !!this.abridged,
|
abridged: !!this.abridged,
|
||||||
rating: this.rating
|
rating: this.providerRating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,8 +417,8 @@ class Book extends Model {
|
|||||||
this.abridged = !!payload.metadata.abridged
|
this.abridged = !!payload.metadata.abridged
|
||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
}
|
}
|
||||||
if (payload.metadata.rating !== undefined && this.rating !== payload.metadata.rating) {
|
if (payload.metadata.rating !== undefined && this.providerRating !== payload.metadata.rating) {
|
||||||
this.rating = payload.metadata.rating
|
this.providerRating = payload.metadata.rating
|
||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
}
|
}
|
||||||
const arrayOfStringsKeys = ['narrators', 'genres']
|
const arrayOfStringsKeys = ['narrators', 'genres']
|
||||||
@ -604,7 +601,7 @@ class Book extends Model {
|
|||||||
language: this.language,
|
language: this.language,
|
||||||
explicit: this.explicit,
|
explicit: this.explicit,
|
||||||
abridged: this.abridged,
|
abridged: this.abridged,
|
||||||
rating: this.rating
|
rating: this.providerRating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,7 +624,7 @@ class Book extends Model {
|
|||||||
language: this.language,
|
language: this.language,
|
||||||
explicit: this.explicit,
|
explicit: this.explicit,
|
||||||
abridged: this.abridged,
|
abridged: this.abridged,
|
||||||
rating: this.rating
|
rating: this.providerRating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,7 +636,7 @@ class Book extends Model {
|
|||||||
oldMetadataJSON.narratorName = (this.narrators || []).join(', ')
|
oldMetadataJSON.narratorName = (this.narrators || []).join(', ')
|
||||||
oldMetadataJSON.seriesName = this.seriesName
|
oldMetadataJSON.seriesName = this.seriesName
|
||||||
oldMetadataJSON.descriptionPlain = this.description ? htmlSanitizer.stripAllTags(this.description) : null
|
oldMetadataJSON.descriptionPlain = this.description ? htmlSanitizer.stripAllTags(this.description) : null
|
||||||
oldMetadataJSON.rating = this.rating
|
oldMetadataJSON.rating = this.providerRating
|
||||||
return oldMetadataJSON
|
return oldMetadataJSON
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user