Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Admin): user Name field suggestions have an async problem
Browse files Browse the repository at this point in the history
  • Loading branch information
sstamer committed May 4, 2023
1 parent ac14305 commit e4e86ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tine20/Admin/js/user/EditDialog.js
Expand Up @@ -1163,22 +1163,24 @@ Tine.Admin.UserEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
// suggest for new users only!
if (!this.record.id) {
// accountFullName (cn im AD) + accountDisplayName(displayname im AD) + accountLoginName + accountEmailAddress
for (const [fieldName, template] of Object.entries(Tine.Tinebase.configManager.get('accountTwig'))) {
Object.keys(Tine.Tinebase.configManager.get('accountTwig')).asyncForEach(async (fieldName) => {
if (fieldName === 'accountEmailAddress' && ! Tine.Tinebase.registry.get('primarydomain')) {
// skip email without configured domain
continue;
return;
}
const field = this.getForm().findField(fieldName);
// suggest for unchanged fields only
if (field && (!field.suggestedValue || field.getValue() === field.suggestedValue)) {
this.onRecordUpdate();
// @FIXME twing can't cope with null values yet, remove this once twing fixed it
const accountData = JSON.parse(JSON.stringify(this.record.data).replace(/:null([,}])/g, ':""$1'));
const suggestion = this.twingEnv.render(fieldName, {account: accountData, email: {primarydomain: Tine.Tinebase.registry.get('primarydomain')}});
const suggestion = await this.twingEnv.render(fieldName, {account: accountData, email: {primarydomain: Tine.Tinebase.registry.get('primarydomain')}});

field.setValue(suggestion);
this.record.set(fieldName, suggestion);
field.suggestedValue = suggestion;
}
}
});
}
},

Expand Down

0 comments on commit e4e86ac

Please sign in to comment.