mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Update itemTagsSelected migration
This commit is contained in:
parent
0387436111
commit
56e213d654
@ -169,11 +169,10 @@ class User {
|
|||||||
if (this.permissions.accessAllTags === undefined) this.permissions.accessAllTags = true
|
if (this.permissions.accessAllTags === undefined) this.permissions.accessAllTags = true
|
||||||
// Explicit content restriction permission added v2.0.18
|
// Explicit content restriction permission added v2.0.18
|
||||||
if (this.permissions.accessExplicitContent === undefined) this.permissions.accessExplicitContent = true
|
if (this.permissions.accessExplicitContent === undefined) this.permissions.accessExplicitContent = true
|
||||||
// itemTagsAccessible was renamed to itemTagsSelected in version v2.x
|
// itemTagsAccessible was renamed to itemTagsSelected in version v2.2.20
|
||||||
if (this.itemTagsAccessible) {
|
if (user.itemTagsAccessible?.length) {
|
||||||
this.permissions.selectedTagsNotAccessible = false
|
this.permissions.selectedTagsNotAccessible = false
|
||||||
this.itemTagsSelected = this.itemTagsAccessible
|
user.itemTagsSelected = user.itemTagsAccessible
|
||||||
this.itemTagsAccessible = undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.librariesAccessible = [...(user.librariesAccessible || [])]
|
this.librariesAccessible = [...(user.librariesAccessible || [])]
|
||||||
@ -352,10 +351,10 @@ class User {
|
|||||||
checkCanAccessLibraryItemWithTags(tags) {
|
checkCanAccessLibraryItemWithTags(tags) {
|
||||||
if (this.permissions.accessAllTags) return true
|
if (this.permissions.accessAllTags) return true
|
||||||
if (this.permissions.selectedTagsNotAccessible) {
|
if (this.permissions.selectedTagsNotAccessible) {
|
||||||
if (!tags || !tags.length) return true
|
if (!tags?.length) return true
|
||||||
return tags.every(tag => !this.itemTagsSelected.includes(tag))
|
return tags.every(tag => !this.itemTagsSelected.includes(tag))
|
||||||
}
|
}
|
||||||
if (!tags || !tags.length) return false
|
if (!tags?.length) return false
|
||||||
return this.itemTagsSelected.some(tag => tags.includes(tag))
|
return this.itemTagsSelected.some(tag => tags.includes(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user