From 1c158627b1862fca09160b46ce60a9b6dd4cd96c Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 24 Aug 2022 02:11:05 -0300 Subject: [PATCH] Prevent from being temp forever --- apps/meteor/app/models/client/models/ChatMessage.ts | 5 ++++- apps/meteor/app/threads/client/flextab/thread.ts | 8 ++++---- apps/meteor/app/ui/client/lib/ChatMessages.ts | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/meteor/app/models/client/models/ChatMessage.ts b/apps/meteor/app/models/client/models/ChatMessage.ts index 2b039db75a25..93cb48d3f038 100644 --- a/apps/meteor/app/models/client/models/ChatMessage.ts +++ b/apps/meteor/app/models/client/models/ChatMessage.ts @@ -25,7 +25,10 @@ class ChatMessageCollection extends Mongo.Collection & { +export const ChatMessage = new ChatMessageCollection() as unknown as Mongo.Collection< + Omit & { ignored?: boolean }, + IMessage & { ignored?: boolean } +> & { direct: Mongo.Collection, IMessage>; queries: unknown[]; diff --git a/apps/meteor/app/threads/client/flextab/thread.ts b/apps/meteor/app/threads/client/flextab/thread.ts index 585716f51947..0fd2b1743ad0 100644 --- a/apps/meteor/app/threads/client/flextab/thread.ts +++ b/apps/meteor/app/threads/client/flextab/thread.ts @@ -27,7 +27,7 @@ type ThreadTemplateInstance = Blaze.TemplateInstance<{ mainMessage: IMessage; }> & { firstNode: HTMLElement; - Threads: Mongo.Collection & { + Threads: Mongo.Collection, IMessage> & { direct: Mongo.Collection, IMessage>; queries: unknown[]; }; @@ -169,7 +169,7 @@ Template.thread.helpers({ }); Template.thread.onCreated(async function (this: ThreadTemplateInstance) { - this.Threads = new Mongo.Collection(null) as Mongo.Collection & { + this.Threads = new Mongo.Collection(null) as Mongo.Collection, IMessage> & { direct: Mongo.Collection, IMessage>; queries: unknown[]; }; @@ -304,10 +304,10 @@ Template.thread.onRendered(function (this: ThreadTemplateInstance) { }, ).observe({ added: ({ _id, ...message }: IMessage) => { - this.Threads.upsert({ _id }, { $set: message }); + this.Threads.upsert({ _id }, message); }, changed: ({ _id, ...message }: IMessage) => { - this.Threads.update({ _id }, { $set: message }); + this.Threads.update({ _id }, message); }, removed: ({ _id }: IMessage) => this.Threads.remove(_id), }); diff --git a/apps/meteor/app/ui/client/lib/ChatMessages.ts b/apps/meteor/app/ui/client/lib/ChatMessages.ts index a41015e8bf85..a87155a6a2ec 100644 --- a/apps/meteor/app/ui/client/lib/ChatMessages.ts +++ b/apps/meteor/app/ui/client/lib/ChatMessages.ts @@ -54,7 +54,7 @@ export class ChatMessages { $input: JQuery | undefined; constructor( - public collection: Mongo.Collection & { + public collection: Mongo.Collection, IMessage> & { direct: Mongo.Collection, IMessage>; queries: unknown[]; } = ChatMessage,