MCPcopy Create free account
hub / github.com/async-labs/async / deleteMessageStoreMethod

Method deleteMessageStoreMethod

app/lib/store/Chat.ts:301–329  ·  view source on GitHub ↗
({ message, teamId }: { message: Message; teamId: string })

Source from the content-addressed store, hash-verified

299
300 // done: add parentMessageId
301 public async deleteMessageStoreMethod({ message, teamId }: { message: Message; teamId: string }) {
302 await deleteMessageApiMethod({
303 id: message.messageId,
304 chatId: this.chatId,
305 teamId,
306 socketId: (this.store.socket && this.store.socket.id) || null,
307 });
308
309 if (this.store.currentUser.unreadBySomeoneMessageIds.includes(message.messageId)) {
310 runInAction(() => {
311 this.store.currentUser.unreadBySomeoneMessageIds.remove(message.messageId);
312 });
313 }
314
315 if (message.parentMessageId) {
316 runInAction(() => {
317 const parentMessage = this.messages.find((m) => m.messageId === message.parentMessageId);
318 parentMessage.messagesInsideThread.remove(message);
319 parentMessage.countOfThreadMessages = parentMessage.countOfThreadMessages - 1;
320 });
321 } else {
322 runInAction(() => {
323 this.messages.remove(message);
324 this.numberOfMessagesPerChat = this.numberOfMessagesPerChat - 1;
325 });
326 }
327
328 // update User.unreadBySomeoneMessageIds
329 }
330
331 get creator() {
332 const creator: any = this.members.find((m) => {

Callers 1

ChatDetailClass · 0.80

Calls 1

deleteMessageApiMethodFunction · 0.90

Tested by

no test coverage detected