From 34172704dceb2a2d39e91dede8dbccd9f40ee1a0 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 12 Dec 2022 13:10:53 -0700 Subject: [PATCH] Fix SelectAccount didn't always get values into options correctly --- api/js/etemplate/Et2Select/Et2SelectAccount.ts | 2 +- api/js/etemplate/Et2Select/SelectAccountMixin.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Select/Et2SelectAccount.ts b/api/js/etemplate/Et2Select/Et2SelectAccount.ts index 3ab73ab421..22b2f76a6d 100644 --- a/api/js/etemplate/Et2Select/Et2SelectAccount.ts +++ b/api/js/etemplate/Et2Select/Et2SelectAccount.ts @@ -75,7 +75,7 @@ export class Et2SelectAccount extends SelectAccountMixin(Et2Select) { return []; } - let select_options : Array = [...this.__select_options] || []; + let select_options : Array = [...super.select_options] || []; // for primary_group we only display owngroups == own memberships, not other groups if (type === 'primary_group' && this.accountType !== 'accounts') { diff --git a/api/js/etemplate/Et2Select/SelectAccountMixin.ts b/api/js/etemplate/Et2Select/SelectAccountMixin.ts index af0234c6e1..fb0e3fe0ce 100644 --- a/api/js/etemplate/Et2Select/SelectAccountMixin.ts +++ b/api/js/etemplate/Et2Select/SelectAccountMixin.ts @@ -54,6 +54,12 @@ export const SelectAccountMixin = >(superclass let val = Array.isArray(this.value) ? this.value : [this.value]; for(let id of val) { + // Don't add if it's already there + if(this.account_options.findIndex(o => o.value == id) != -1) + { + continue; + } + let account_name = null; let option = {value: id, label: id + " ..."}; this.account_options.push(option);