improve chat

This commit is contained in:
Peter Maquiran
2023-01-09 14:51:00 +01:00
parent 6fad1bd688
commit efa7774c1c
2 changed files with 18 additions and 8 deletions
@@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import * as FIFOProcessQueue from 'fifo-process-queue';
import { async } from 'rxjs';
import { RoomService } from './room.service';
@Injectable({
@@ -21,11 +22,15 @@ export class ViewedMessageService {
room.deleteMessageToReceive(userId)
}
let n = 0
for (const message of room.messages) {
if(message.online) {
for(let id of membersIds) {
if(message.addReceived(id)) {
await message.saveChanges()
n++
setTimeout(async() => {
await message.saveChanges()
}, 100 * n)
}
}
}
@@ -44,13 +49,18 @@ export class ViewedMessageService {
const membersIds: string[] = room.membersExcludeMe.map((user)=> user._id)
let n = 0
for (const message of room.messages) {
if(message.online) {
for(let id of membersIds) {
if(message.addViewed(id)) {
message.addReceived(id)
await message.saveChanges()
n++
setTimeout(async() => {
await message.saveChanges()
}, 100 * n)
}
}
}
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = {
"shortSHA": "d4557a22b",
"SHA": "d4557a22b167467a079db982f9d103ee0d1052bc",
"shortSHA": "6fad1bd68",
"SHA": "6fad1bd688cc8a612840124594abba1ea12a4b3d",
"branch": "consoleCle2",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Mon Jan 9 14:25:49 2023 +0100'",
"lastCommitMessage": "save",
"lastCommitNumber": "4621",
"lastCommitTime": "'Mon Jan 9 14:42:33 2023 +0100'",
"lastCommitMessage": "fix merge",
"lastCommitNumber": "4622",
"change": "",
"changeStatus": "On branch consoleCle2\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/app.module.ts",
"changeStatus": "On branch consoleCle2\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/services/chat/viewed-message.service.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran"
}