[ISSUE 225] fixed

This commit is contained in:
richard-loafle 2020-02-07 17:48:52 +09:00
parent 2ce0f3af3b
commit 1fb8b4864f
4 changed files with 59 additions and 21 deletions

View File

@ -37,6 +37,11 @@
| translate: { bannedWords: bannedWords.join(',') }
}}
</mat-error>
<mat-error
*ngIf="inputForm.get('groupName').hasError('groupNameSamed')"
>
{{ 'group.errors.sameNameExist' | translate }}
</mat-error>
</mat-form-field>
</form>
</div>
@ -99,6 +104,7 @@
[selectedUserList]="selectedUserList"
[ignoreUserList]="data.curRoomUser"
[checkable]="true"
[activate$]="groupTreeActivatedSubject.asObservable()"
(checkGroup)="onCheckGroup($event)"
class="group-expansion"
>
@ -194,23 +200,23 @@
</mat-icon>
</ng-template>
<div fxFlexFill style="max-height: 508px;">
<perfect-scrollbar fxFlex="1 1 auto" >
<div class="mat-tab-frame dialog-tab-chatlist">
<ucap-room-list-item
*ngFor="let room of roomList"
[loginRes]="loginRes"
[roomInfo]="room"
[roomUserInfo]="getRoomUserList(room)"
[sessionVerinfo]="sessionVerinfo"
[checkable]="getCheckableRoom(room)"
[isChecked]="getCheckedRoom(room)"
[multiCheckable]="false"
(checkRoom)="onCheckRoom($event)"
(click)="onToggleRoom(room)"
class="chat checkbox"
>
</ucap-room-list-item>
</div>
<perfect-scrollbar fxFlex="1 1 auto">
<div class="mat-tab-frame dialog-tab-chatlist">
<ucap-room-list-item
*ngFor="let room of roomList"
[loginRes]="loginRes"
[roomInfo]="room"
[roomUserInfo]="getRoomUserList(room)"
[sessionVerinfo]="sessionVerinfo"
[checkable]="getCheckableRoom(room)"
[isChecked]="getCheckedRoom(room)"
[multiCheckable]="false"
(checkRoom)="onCheckRoom($event)"
(click)="onToggleRoom(room)"
class="chat checkbox"
>
</ucap-room-list-item>
</div>
</perfect-scrollbar>
</div>
</mat-tab>

View File

@ -19,7 +19,13 @@ import {
MatTabChangeEvent
} from '@angular/material';
import { NGXLogger } from 'ngx-logger';
import { Observable, combineLatest, Subscription, of } from 'rxjs';
import {
Observable,
combineLatest,
Subscription,
of,
BehaviorSubject
} from 'rxjs';
import { map, tap, catchError, take } from 'rxjs/operators';
import { Store, select } from '@ngrx/store';
@ -170,6 +176,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
{ group: GroupDetailData; buddyList: UserInfo[] }[]
>;
favoritBuddyList$: Observable<UserInfo[]>;
groupList: GroupDetailData[];
// 대화방
roomList: RoomInfo[];
@ -192,6 +199,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
bannedWords: string[] = [];
groupTreeActivatedSubject = new BehaviorSubject<boolean>(false);
ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.companyCode = loginInfo.companyCode;
@ -256,6 +265,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
groupList = tempOrderArr;
}
this.groupList = groupList;
const groupBuddyList: {
group: GroupDetailData;
buddyList: UserInfo[];
@ -318,7 +329,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
[
Validators.required,
this.checkSpecialCharacter(),
this.checkBanWords()
this.checkBanWords(),
this.checkSameName()
]
]
});
@ -350,6 +362,22 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
};
}
checkSameName(): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } | null => {
if (
!control ||
!control.value ||
!this.groupList ||
0 === this.groupList.length
) {
return null;
}
const v = (control.value as string).trim();
const ban = -1 < this.groupList.findIndex(g => g.name === v);
return ban ? { groupNameSamed: { value: control.value } } : null;
};
}
ngOnDestroy(): void {
if (!!this.roomSubscription) {
this.roomSubscription.unsubscribe();
@ -403,6 +431,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.selectedRoom = null;
}
this.groupTreeActivatedSubject.next(0 === tabChangeEvent.index);
this.store.dispatch(
SettingsStore.organizationTreeActivated({
activate: 1 === tabChangeEvent.index

View File

@ -178,7 +178,8 @@
"errors": {
"label": "Group errors",
"requireName": "Group name is required.",
"bannedWords": "Prohibited word. [{{bannedWords}}]"
"bannedWords": "Prohibited word. [{{bannedWords}}]",
"sameNameExist": "Group name already exists."
}
},
"chat": {

View File

@ -178,7 +178,8 @@
"errors": {
"label": "그룹 에러",
"requireName": "그룹명은 필수입력입니다.",
"bannedWords": "금지단어 [{{bannedWords}}]"
"bannedWords": "금지단어 [{{bannedWords}}]",
"sameNameExist": "이미 존재하는 그룹명입니다."
}
},
"chat": {