From 055fb1c82721dd018aa343d54585d5791e9f30a7 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Mon, 6 Sep 2021 14:47:03 +0800 Subject: [PATCH] fix(webui): display custom roles in book edit dialog --- .../src/components/dialogs/EditBooksDialog.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/komga-webui/src/components/dialogs/EditBooksDialog.vue b/komga-webui/src/components/dialogs/EditBooksDialog.vue index ec724dd0d..f0fe56ae1 100644 --- a/komga-webui/src/components/dialogs/EditBooksDialog.vue +++ b/komga-webui/src/components/dialogs/EditBooksDialog.vue @@ -376,9 +376,15 @@ export default Vue.extend({ }, computed: { authorRoles(): NameValue[] { - return authorRoles.map((x: string) => ({ - name: this.$t(`author_roles.${x}`).toString(), - value: x, + let remoteRoles = [] + if (Array.isArray(this.books)) + remoteRoles = this.books.flatMap(b => b.metadata.authors).map(a => a.role) + else + remoteRoles = this.books.metadata.authors.map(a => a.role) + const allRoles = this.$_.uniq([...authorRoles, ...remoteRoles]) + return allRoles.map((role: string) => ({ + name: this.$te(`author_roles.${role}`) ? this.$t(`author_roles.${role}`).toString() : role, + value: role, })) }, single(): boolean {