remove expired room

This commit is contained in:
Peter Maquiran
2024-10-07 13:27:49 +01:00
parent d8eb3ddbd6
commit 0dd4fd665b
101 changed files with 698 additions and 4682 deletions
@@ -223,7 +223,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
setTimeout(() => {
this.subscribeToChanges()
}, 500)
}, 500);
})
}
@@ -243,6 +243,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
subscribeToChanges() {
this.listenToIncomingMessage();
this.listenToDeleteMessage();
this.listenToUpdateMessage();
@@ -281,7 +282,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
removeBold() {
if(!this.room?.local) {
this.chatServiceService.removeBoldFromRoom({roomId: this.room.$id})
this.chatServiceService.removeBoldFromRoom({roomId: this.room.id})
}
}
@@ -329,7 +330,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.date = {}
const allMessage = [];
console.time("mappingTime");
//console.time("mappingTime");
const sortMessages = messages.value.sort((a, b) => new Date(a.sentAt).getTime() - new Date(b.sentAt).getTime())
for(const message of sortMessages) {
@@ -342,12 +343,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
allMessage.push(new MessageViewModal(message))
}
console.timeEnd("mappingTime");
//console.timeEnd("mappingTime");
this.messages1[this.room.$id]
this.messages1[this.room.$id] = allMessage
// if(messages.length >= 1) {
// this.messages1[this.room.$id].push(LastMessage)
// }
@@ -451,7 +450,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
roomId: this.room.id
})
} else {
console.log('no need', message )
// console.log('no need', message )
}
}
}
@@ -491,7 +490,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
}
//this.sendReadMessage()
this.chatServiceService.sendReadAt({
memberId: SessionStore.user.UserId,
messageId: message.id,
requestId: '',
roomId: this.room.id
})
setTimeout(() => {
this.scrollToBottomClicked()
@@ -535,7 +539,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
listenToUpdateMessage() {
this.messageUpdateSubject?.unsubscribe();
console.log('liste to update')
// console.log('liste to update')
this.messageUpdateSubject = this.chatServiceService.listenToUpdateMessage(this.room.id).subscribe((updateMessage) => {
const index = this.messages1[this.room.$id].findIndex(e => e?.id === updateMessage.id); // Use triple equals for comparison
@@ -829,14 +833,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if(message.isOk() && this.room.local == IDBoolean.true) {
this.room.local = IDBoolean.false;
// console.log('enter')
// await this.chatServiceService.roomSetLocalToFalseById({
// $roomId: this.room.$id,
// roomId: message.value.roomId
// })
console.log('enter')
await this.chatServiceService.roomSetLocalToFalseById({
$roomId: this.room.$id,
roomId: message.value.roomId
})
this.room.id = message.value.roomId
// this.subscribeToChanges()
this.subscribeToChanges()
}
}