From 1bbcdbfeb70aa66d70cb1d61c039886dacb3fae4 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 1 Sep 2022 08:30:43 -0600 Subject: [PATCH] Fix Et2SelectAccount couldn't have non-account options, so freeEntries didn't show up --- api/js/etemplate/Et2Select/Et2SelectAccount.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/Et2Select/Et2SelectAccount.ts b/api/js/etemplate/Et2Select/Et2SelectAccount.ts index 746bf3ed5a..285208d4f7 100644 --- a/api/js/etemplate/Et2Select/Et2SelectAccount.ts +++ b/api/js/etemplate/Et2Select/Et2SelectAccount.ts @@ -77,25 +77,29 @@ export class Et2SelectAccount extends Et2Select { return []; } - let select_options : Array = []; + let select_options : Array = [...this.__select_options] || []; // for primary_group we only display owngroups == own memberships, not other groups if (type === 'primary_group' && this.accountType !== 'accounts') { if (this.accountType === 'both') { - select_options = this.egw().accounts('accounts'); + select_options = select_options.concat(this.egw().accounts('accounts')); } select_options = select_options.concat(this.egw().accounts('owngroups')); } else { - select_options = this.egw().accounts(this.accountType); + select_options = select_options.concat(this.egw().accounts(this.accountType)); } // egw.accounts returns value as number, causing the et2-select to not match the option - select_options.forEach(option => { + select_options.forEach(option => + { option.value = option.value.toString(); }); - return select_options; + return select_options.filter((value, index, self) => + { + return self.findIndex(v => v.value === value.value) === index; + }); } set select_options(new_options : SelectOption[])