mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
remove duplicate
This commit is contained in:
@@ -310,7 +310,7 @@ export class MessageService {
|
||||
|
||||
async addMessageDB() {
|
||||
if(!this.addToDb) {
|
||||
this.addToDb= true
|
||||
this.addToDb = true
|
||||
const message = this.getChatObj()
|
||||
|
||||
delete message.id
|
||||
|
||||
@@ -237,18 +237,20 @@ export class RoomService {
|
||||
let IncomingChatMessageArgs = IncomingChatMessage.fields.args[0]
|
||||
let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs)
|
||||
|
||||
if(!this.messagesLocalReference.includes(ChatMessage.localReference)) {
|
||||
const allMessageIds = this.messages.map((e)=> e._id);
|
||||
|
||||
if(!this.messagesLocalReference.includes(ChatMessage.localReference) && !allMessageIds.includes(ChatMessage?._id)) {
|
||||
|
||||
this.messagesLocalReference.push(ChatMessage.localReference);
|
||||
|
||||
const message = await this.prepareCreate({message: ChatMessage, save: true})
|
||||
const message = await this.prepareCreate({message: ChatMessage, save: true});
|
||||
message.messageSend = true
|
||||
|
||||
this.lastMessage = message
|
||||
this.calDateDuration(ChatMessage._updatedAt)
|
||||
this.lastMessage = message;
|
||||
this.calDateDuration(ChatMessage._updatedAt);
|
||||
|
||||
if (message.t == 'r') {
|
||||
this.name = message.msg
|
||||
this.name = message.msg;
|
||||
}
|
||||
|
||||
if(this.isSenderIsNotMe(ChatMessage)) {
|
||||
@@ -739,10 +741,10 @@ export class RoomService {
|
||||
|
||||
|
||||
await this.messages.forEach( async (message, index) => {
|
||||
if(message._id) {
|
||||
if(message._id) {
|
||||
if(message.viewed.length == 0) {
|
||||
this.messages[index].viewed = membersIds
|
||||
this.messages[index].received = membersIds
|
||||
this.messages[index].viewed = membersIds;
|
||||
this.messages[index].received = membersIds;
|
||||
|
||||
await this.messages[index].save()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user