diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index de308179..935fb921 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -1588,7 +1588,32 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { break; case 'ADD_MEMBER': { - const curRoomUser = this.userInfoListSubject.value.filter( + const userInfoList = this.userInfoListSubject.value; + if ( + !!userInfoList && + userInfoList.length >= + environment.productConfig.CommonSetting.maxChatRoomUser + ) { + this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + data: { + title: this.translateService.instant('chat.errors.label'), + html: this.translateService.instant( + 'chat.errors.maxCountOfRoomMemberWith', + { + maxCount: + environment.productConfig.CommonSetting.maxChatRoomUser + } + ) + } + }); + return; + } + + const curRoomUser = userInfoList.filter( user => user.seq !== this.loginResSubject.value.userSeq && user.isJoinRoom ); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts index a7511be1..647c15aa 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/room-user-list.component.ts @@ -21,7 +21,10 @@ import { DialogService, ConfirmDialogComponent, ConfirmDialogResult, - ConfirmDialogData + ConfirmDialogData, + AlertDialogComponent, + AlertDialogData, + AlertDialogResult } from '@ucap-webmessenger/ui'; import { SelectGroupDialogComponent, @@ -43,6 +46,7 @@ import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { MatDialog } from '@angular/material/dialog'; import { MatMenuTrigger } from '@angular/material/menu'; import { TranslateService } from '@ngx-translate/core'; +import { environment } from 'projects/ucap-webmessenger-app/src/environments/environment.dev'; @Component({ selector: 'app-layout-chat-right-drawer-room-user-list', @@ -139,6 +143,29 @@ export class RoomUserListComponent implements OnInit, OnDestroy { } async onClickAddMember() { + if ( + !!this.userInfoList && + this.userInfoList.length >= + environment.productConfig.CommonSetting.maxChatRoomUser + ) { + this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + data: { + title: this.translateService.instant('chat.errors.label'), + html: this.translateService.instant( + 'chat.errors.maxCountOfRoomMemberWith', + { + maxCount: environment.productConfig.CommonSetting.maxChatRoomUser + } + ) + } + }); + return; + } + const curRoomUser = this.userInfoList.filter( user => user.seq !== this.loginRes.userSeq && user.isJoinRoom ); diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts index 9cf07234..5caa44ff 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts @@ -5,6 +5,8 @@ import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Store, select } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; +import { environment } from '../../../../environments/environment'; + import { of } from 'rxjs'; import { tap, @@ -79,6 +81,8 @@ import { AlertDialogData, AlertDialogResult } from '@ucap-webmessenger/ui'; +import { ActivatedRouteSnapshot } from '@angular/router'; +import { TranslateService } from '@ngx-translate/core'; @Injectable() export class Effects { @@ -285,6 +289,29 @@ export class Effects { ) ), exhaustMap(([action, roomInfo]) => { + if ( + environment.productConfig.CommonSetting.maxChatRoomUser < + action.req.userSeqs.length + ) { + this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + data: { + title: this.translateService.instant('chat.errors.label'), + html: this.translateService.instant( + 'chat.errors.maxCountOfRoomMemberWith', + { + maxCount: + environment.productConfig.CommonSetting.maxChatRoomUser + } + ) + } + }); + return of(inviteFailure({ error: 'over size room users !!' })); + } + if (roomInfo.roomType === RoomType.Single) { // Re Open return this.roomProtocolService.open(action.req).pipe( @@ -454,6 +481,7 @@ export class Effects { private store: Store, private roomProtocolService: RoomProtocolService, private sessionStorageService: SessionStorageService, + private translateService: TranslateService, private dialogService: DialogService, private logger: NGXLogger ) {}