[AAE-1594] Fix partial group name of a valid group should not be valid, fix form-cloud able to search when people/group widget is readonly (#5417)

This commit is contained in:
arditdomi
2020-01-29 09:23:03 +00:00
committed by GitHub
parent 2e71bc6e27
commit 95c7074d65
4 changed files with 11 additions and 9 deletions

View File

@@ -266,7 +266,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
await Promise.all(preselectedGroupsToValidate.map(async (group: IdentityGroupModel) => {
try {
const validationResult = await this.searchGroup(group.name);
if (!this.hasGroupIdOrName(validationResult)) {
if (this.isPreselectedGroupInvalid(group, validationResult)) {
this.invalidGroups.push(group);
}
} catch (error) {
@@ -380,8 +380,12 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
this.searchGroupsSubject.next(this.searchGroups);
}
hasGroupIdOrName(group: IdentityGroupModel): boolean {
return group && (group.id !== undefined || group.name !== undefined);
isPreselectedGroupInvalid(preselectedGroup: IdentityGroupModel, validatedGroup: IdentityGroupModel): boolean {
if (validatedGroup && validatedGroup.name !== undefined) {
return preselectedGroup.name !== validatedGroup.name;
} else {
return true;
}
}
isSingleMode(): boolean {