diff --git a/client/components/modals/AccountModal.vue b/client/components/modals/AccountModal.vue index 5a020706..7623a1a5 100644 --- a/client/components/modals/AccountModal.vue +++ b/client/components/modals/AccountModal.vue @@ -88,7 +88,7 @@
- +
@@ -162,9 +162,6 @@ export default { }, methods: { accessAllTagsToggled(val) { - if (!val) { - this.fetchAllTags() - } if (!val && !this.newUser.itemTagsAccessible.length) { this.newUser.itemTagsAccessible = this.libraries.map((l) => l.id) } else if (val && this.newUser.itemTagsAccessible.length) { @@ -275,8 +272,11 @@ export default { } }, init() { + this.fetchAllTags() + this.isNew = !this.account if (this.account) { + console.log(this.account) this.newUser = { username: this.account.username, password: this.account.password, diff --git a/client/components/ui/MultiSelectDropdown.vue b/client/components/ui/MultiSelectDropdown.vue index e705c486..0f87513c 100644 --- a/client/components/ui/MultiSelectDropdown.vue +++ b/client/components/ui/MultiSelectDropdown.vue @@ -62,7 +62,7 @@ export default { }, selectedItems() { return (this.value || []).map((v) => { - return this.items.find((i) => i.value === v) || {} + return this.items.find((i) => i.value === v) || { text: v, value: v } }) } }, @@ -113,6 +113,7 @@ export default { removeItem(itemValue) { var remaining = this.selected.filter((i) => i !== itemValue) this.$emit('input', remaining) + this.$nextTick(() => { this.recalcMenuPos() }) diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index f4584ab6..cbc314cf 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -253,7 +253,13 @@ class LibraryController { minified: req.query.minified === '1' } - var collections = this.db.collections.filter(c => c.libraryId === req.library.id).map(c => c.toJSONExpanded(libraryItems, payload.minified)) + var collections = this.db.collections.filter(c => c.libraryId === req.library.id).map(c => { + var expanded = c.toJSONExpanded(libraryItems, payload.minified) + // If all books restricted to user in this collection then hide this collection + if (!expanded.books.length && c.books.length) return null + return expanded + }).filter(c => !!c) + payload.total = collections.length if (payload.limit) { diff --git a/server/objects/user/User.js b/server/objects/user/User.js index 66f72e09..d68a8787 100644 --- a/server/objects/user/User.js +++ b/server/objects/user/User.js @@ -308,7 +308,8 @@ class User { } checkCanAccessLibraryItemWithTags(tags) { - if (this.permissions.accessAllTags || !tags || !tags.length) return true + if (!tags || !tags.length) return false + if (this.permissions.accessAllTags) return true return this.itemTagsAccessible.some(tag => tags.includes(tag)) }