채팅방 설정 수정

> 채팅입력창 enable 관련 처리.
> 봇방 방제목 처리.
This commit is contained in:
leejh 2019-11-06 17:32:27 +09:00
parent bca6a54a24
commit 1dc65479e1
2 changed files with 31 additions and 5 deletions

View File

@ -124,7 +124,7 @@
<!-- / CHAT CONTENT -->
<!-- CHAT FOOTER -->
<div fxFlex="0 0 auto" fxLayout="column">
<div fxFlex="0 0 auto" fxLayout="column" *ngIf="getEnableSend()">
<!-- REPLY FORM -->
<ucap-chat-form
#chatForm

View File

@ -87,7 +87,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
@ViewChild('messageBoxContainer', { static: true })
private messageBoxContainer: ElementRef;
@ViewChild('chatForm', { static: true })
@ViewChild('chatForm', { static: false })
private chatForm: UCapUiChatFormComponent;
@ViewChild('messageContextMenuTrigger', { static: true })
@ -224,10 +224,18 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
return '대화방명을 가져오고 있습니다..';
}
switch (this.roomInfo.roomType) {
case RoomType.Mytalk:
return 'MyTalk';
case RoomType.Bot:
case RoomType.Allim:
return this.userInfoList
.filter(user => user.seq !== this.loginRes.userSeq)
.map(user => user.name);
}
if (!!this.roomInfo.roomName && '' !== this.roomInfo.roomName.trim()) {
return this.roomInfo.roomName;
} else if (this.roomInfo.roomType === RoomType.Mytalk) {
return 'MyTalk';
} else {
return this.userInfoList
.filter(user => {
@ -243,6 +251,22 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
}
}
getEnableSend() {
if (!this.roomInfo) {
return false;
}
if (
this.roomInfo.roomType === RoomType.Bot ||
this.roomInfo.roomType === RoomType.Allim ||
this.roomInfo.roomType === RoomType.Link
) {
return false;
}
return true;
}
getConvertTimer(timerInterval: number, unit: number = 1) {
if (timerInterval >= 0 && timerInterval < 60 * unit) {
return Math.floor((timerInterval / 1) * unit) + ' 초';
@ -266,7 +290,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
focusReplyInput(): void {
setTimeout(() => {
this.chatForm.focus();
if (!!this.chatForm) {
this.chatForm.focus();
}
});
}