mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
validate user permision on chat
This commit is contained in:
@@ -40,8 +40,8 @@ import { SpeakerService, StartRecordingResultError, StopRecordingResultError } f
|
||||
import { compressImageBase64 } from 'src/app/utils/imageCompressore';
|
||||
import { ChatPopoverPage } from '../../modal/chat-popover/chat-popover.page';
|
||||
import { LastMessage } from '../../utils/lastMessage';
|
||||
import { UserTypingLocalRepository } from 'src/app/module/chat/data/repository/user-typing-local-data-source.service';
|
||||
import { UserTypingRemoteRepositoryService } from 'src/app/module/chat/data/repository/user-typing-live-data-source.service';
|
||||
import { UserTypingLocalRepository } from 'src/app/module/chat/data/repository/typing/user-typing-local-data-source.service';
|
||||
import { UserTypingRemoteRepositoryService } from 'src/app/module/chat/data/repository/typing/user-typing-live-data-source.service';
|
||||
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service';
|
||||
import { RoomType } from "src/app/module/chat/domain/entity/group";
|
||||
import { RoomTable } from 'src/app/module/chat/infra/database/dexie/schema/room';
|
||||
@@ -67,6 +67,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
downloadProgess = 0;
|
||||
|
||||
roomType!: RoomType
|
||||
RoomTypeEnum = RoomType
|
||||
|
||||
@Input() roomId: string;
|
||||
@Input() showMessages: string;
|
||||
|
||||
@@ -137,6 +139,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
messageDeleteSubject: Subscription
|
||||
messageUpdateSubject: Subscription
|
||||
messageSendSubject: Subscription
|
||||
messageTypingSubject: Subscription
|
||||
|
||||
messages1: {[key: string]: MessageEntity[]} = {}
|
||||
MessageAttachmentFileType = MessageAttachmentFileType
|
||||
@@ -177,7 +180,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
|
||||
|
||||
this.roomData$ = this.RoomLocalRepository.getRoomByIdLive(this.roomId)
|
||||
|
||||
this.roomData$.subscribe(e => {
|
||||
@@ -198,20 +200,34 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.roomMembers$ = this.MemberListLocalRepository.getRoomMemberByIdLive(this.roomId).pipe(
|
||||
tap((members) => {
|
||||
this.totalMembers = members.length
|
||||
for(const member of members) {
|
||||
if(member.wxUserId == SessionStore.user.UserId) {
|
||||
this.isAdmin = member.isAdmin
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
this.roomStatus$ = this.MemberListLocalRepository.allMemberOnline(this.roomId)
|
||||
this.chatServiceService.getRoomById(this.roomId)
|
||||
|
||||
this.userTypingLocalRepository.getUserTypingLive().subscribe((e) => {
|
||||
const arrayNames = e.map(e => e.userName)
|
||||
|
||||
this.messageTypingSubject?.unsubscribe()
|
||||
this.messageTypingSubject = this.userTypingLocalRepository.getUserTypingLiveByRoomId(this.roomId).subscribe((e) => {
|
||||
const arrayNames = e.filter((b)=> b.userId != SessionStore.user.UserId).map(e => e.userName)
|
||||
this.userTyping$ = e as any
|
||||
|
||||
const uniqueArray = [...new Set(arrayNames)];
|
||||
|
||||
(this.myInputRef.nativeElement as HTMLDivElement).innerHTML = '::'+ uniqueArray
|
||||
})
|
||||
console.log({uniqueArray})
|
||||
|
||||
if(uniqueArray.length >= 1) {
|
||||
(this.myInputRef.nativeElement as HTMLDivElement).innerHTML = uniqueArray + '...'
|
||||
} else {
|
||||
(this.myInputRef.nativeElement as HTMLDivElement).innerHTML = ''
|
||||
}
|
||||
|
||||
}) as any
|
||||
|
||||
}
|
||||
|
||||
messageStatus(message: MessageEntity) {
|
||||
@@ -242,7 +258,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.messages1[this.roomId] = []
|
||||
this.messages1[this.roomId] = messages
|
||||
|
||||
this.messages1[this.roomId].push(LastMessage)
|
||||
if(messages.length >= 1) {
|
||||
this.messages1[this.roomId].push(LastMessage)
|
||||
}
|
||||
|
||||
this.loadAttachment()
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user