diff --git a/client/src/app/site/pages/meetings/modules/participant-search-selector/components/participant-search-selector/participant-search-selector.component.ts b/client/src/app/site/pages/meetings/modules/participant-search-selector/components/participant-search-selector/participant-search-selector.component.ts index c3a6b03d91..68bb444fa7 100644 --- a/client/src/app/site/pages/meetings/modules/participant-search-selector/components/participant-search-selector/participant-search-selector.component.ts +++ b/client/src/app/site/pages/meetings/modules/participant-search-selector/components/participant-search-selector/participant-search-selector.component.ts @@ -1,6 +1,8 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { BehaviorSubject } from 'rxjs'; +import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar'; +import { TranslateService } from '@ngx-translate/core'; +import { BehaviorSubject, filter, firstValueFrom } from 'rxjs'; import { Permission } from 'src/app/domain/definitions/permission'; import { ModelRequestService } from 'src/app/site/services/model-request.service'; import { BaseUiComponent } from 'src/app/ui/base/base-ui-component'; @@ -74,7 +76,9 @@ export class ParticipantSearchSelectorComponent extends BaseUiComponent implemen private userSortService: ParticipantListSortService, private modelRequestService: ModelRequestService, private activeMeeting: ActiveMeetingService, - formBuilder: UntypedFormBuilder + formBuilder: UntypedFormBuilder, + private snackBar: MatSnackBar, + private translate: TranslateService ) { super(); @@ -149,9 +153,19 @@ export class ParticipantSearchSelectorComponent extends BaseUiComponent implemen } } - public async createNewSelectedUser(username: string): Promise { - const newUserObj = await this.userRepo.createFromString(username); + public async createNewSelectedUser(name: string): Promise { + const newUserObj = await this.userRepo.createFromString(name); this.emitSelectedUser({ userId: newUserObj.id, user: newUserObj }); + const user = await firstValueFrom( + this.userRepo.getViewModelObservable(newUserObj.id).pipe(filter(user => !!user)) + ); + this.snackBar.open( + this.translate + .instant(`A user with the username '%username%' and the first name '%first_name%' was created.`) + .replace(`%username%`, user.username) + .replace(`%first_name%`, user.first_name), + this.translate.instant(`Ok`) + ); } private emitSelectedUser(data: UserSelectionData): void { diff --git a/client/src/app/site/pages/meetings/pages/participants/services/common/participant-controller.service/participant-controller.service.ts b/client/src/app/site/pages/meetings/pages/participants/services/common/participant-controller.service/participant-controller.service.ts index 5cc1f91efe..cd841d3aa9 100644 --- a/client/src/app/site/pages/meetings/pages/participants/services/common/participant-controller.service/participant-controller.service.ts +++ b/client/src/app/site/pages/meetings/pages/participants/services/common/participant-controller.service/participant-controller.service.ts @@ -311,9 +311,11 @@ export class ParticipantControllerService extends BaseMeetingControllerService { const newUser = this.parseStringIntoUser(name); + // we want to generate the username in the backend + newUser.username = ``; const newUserPayload: any = { ...newUser, - is_active: true, + is_active: false, group_ids: [this.activeMeeting?.default_group_id] }; const identifiable = (await this.create(newUserPayload))[0];