bugfix :: 대화방 인원이 넘칠경우 막아주는 로직 300명 제한.

This commit is contained in:
leejinho 2020-03-16 16:04:35 +09:00
parent f492aaa8f9
commit eb92529928
3 changed files with 82 additions and 2 deletions

View File

@ -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
);

View File

@ -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
);

View File

@ -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<any>,
private roomProtocolService: RoomProtocolService,
private sessionStorageService: SessionStorageService,
private translateService: TranslateService,
private dialogService: DialogService,
private logger: NGXLogger
) {}