fix(webui): perform case insensitive comparison for existing readlist or collection name

This commit is contained in:
Gauthier Roebroeck 2023-03-02 17:43:25 +08:00
parent 0984d9f8a4
commit 2f97395a24
4 changed files with 4 additions and 4 deletions

View file

@ -116,7 +116,7 @@ export default Vue.extend({
else return [this.series.id]
},
duplicate(): string {
if (this.newCollection !== '' && this.collections.some(e => e.name === this.newCollection)) {
if (this.newCollection !== '' && this.collections.some(e => e.name.toLowerCase() === this.newCollection.toLowerCase())) {
return this.$t('dialog.add_to_collection.field_search_create_error').toString()
} else return ''
},

View file

@ -157,7 +157,7 @@ export default Vue.extend({
},
getErrorsName(): string {
if (this.form.name === '') return this.$t('common.required').toString()
if (this.form.name !== this.collection.name && this.collections.some(e => e.name === this.form.name)) {
if (this.form.name.toLowerCase() !== this.collection.name.toLowerCase() && this.collections.some(e => e.name.toLowerCase() === this.form.name.toLowerCase())) {
return this.$t('dialog.add_to_collection.field_search_create_error').toString()
}
return ''

View file

@ -118,7 +118,7 @@ export default Vue.extend({
else return [this.books.id]
},
duplicate(): string {
if (this.newReadList !== '' && this.readLists.some(e => e.name === this.newReadList)) {
if (this.newReadList !== '' && this.readLists.some(e => e.name.toLowerCase() === this.newReadList.toLowerCase())) {
return this.$t('dialog.add_to_readlist.field_search_create_error').toString()
} else return ''
},

View file

@ -172,7 +172,7 @@ export default Vue.extend({
},
getErrorsName(): string {
if (this.form.name === '') return this.$t('common.required').toString()
if (this.form.name !== this.readList.name && this.readLists.some(e => e.name === this.form.name)) {
if (this.form.name.toLowerCase() !== this.readList.name.toLowerCase() && this.readLists.some(e => e.name.toLowerCase() === this.form.name.toLowerCase())) {
return this.$t('dialog.add_to_readlist.field_search_create_error').toString()
}
return ''