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:
@@ -167,7 +167,7 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
if(result.isOk()) {
|
||||
|
||||
this.openMessage.emit(result.value.data.id);
|
||||
this.openMessage.emit(result.value.id);
|
||||
|
||||
} else if(result.error instanceof HttpErrorResponse) {
|
||||
this.httpErrorHandle.httpStatusHandle(result.error)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<span *ngIf="roomStatus$ | async as roomStatus"><ion-icon *ngIf="roomStatus" class="online" name="ellipse"></ion-icon></span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<button title="Menu" class="btn-no-color" (click)="_openMessagesOptions()">
|
||||
<button title="Menu" class="btn-no-color" (click)="_openMessagesOptions()" *ngIf="roomType == RoomTypeEnum.Group">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
|
||||
</ion-icon>
|
||||
@@ -75,13 +75,13 @@
|
||||
(error)="onImageError()"
|
||||
>
|
||||
|
||||
<div *ngIf="SessionStore.user.UserId == message.sender.wxUserId">
|
||||
<div *ngIf="SessionStore.user.UserId == message.sender.wxUserId && message.oneShot == true">
|
||||
Mandou uma mensagen com visualização única
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div *ngIf="SessionStore.user.UserId != message.sender.wxUserId && message.oneShot == true"> -->
|
||||
<div *ngIf="message.oneShot == true" class="cursor-pointer">
|
||||
<div *ngIf="SessionStore.user.UserId != message.sender.wxUserId && message.oneShot == true">
|
||||
<!-- <div *ngIf="message.oneShot == true" class="cursor-pointer"> -->
|
||||
<div (click)="viewOnce($event, message, i)">
|
||||
Abrir a visualização única
|
||||
</div>
|
||||
@@ -117,7 +117,7 @@
|
||||
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
|
||||
<mat-menu #beforeMenu="matMenu" xPosition="before">
|
||||
<button (click)="messageDelete(message)" class="menuButton">Apagar mensagem</button>
|
||||
<button (click)="editMessage(message)" class="menuButton">Editar mensagem</button>
|
||||
<button *ngIf="!message.hasAttachment" (click)="editMessage(message)" class="menuButton">Editar mensagem</button>
|
||||
<button (click)="toggleEmojiPicker(message)" class="menuButton">Reagir mensagem</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
|
||||
@@ -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