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

Method loadArchivedDiscussionsStoreMethod

app/lib/store/User.ts:403–435  ·  view source on GitHub ↗
({ teamId }: { teamId: string })

Source from the content-addressed store, hash-verified

401 }
402
403 public async loadArchivedDiscussionsStoreMethod({ teamId }: { teamId: string }) {
404 if (this.store.isServer || this.isLoadingDiscussions) {
405 return;
406 }
407
408 this.isLoadingDiscussions = true;
409
410 try {
411 const { discussions = [] } = await getArchivedDiscussionListApiMethod({
412 teamId,
413 });
414
415 runInAction(() => {
416 this.archivedDiscussionsForUser.clear();
417
418 discussions.forEach((d) => {
419 const disObj = this.archivedDiscussionsForUser.find((obj) => obj.discussionId === d._id);
420 if (disObj) {
421 disObj.changeLocalCacheStoreMethod(d);
422 } else {
423 const newD = new Discussion({ team: this.currentTeam, store: this.store, ...d });
424 if (newD.discussionMemberIds.includes(this._id)) {
425 this.archivedDiscussionsForUser.push(newD);
426 }
427 }
428 });
429 });
430 } finally {
431 runInAction(() => {
432 this.isLoadingDiscussions = false;
433 });
434 }
435 }
436
437 get isChatsLinkUnreadForUser() {
438 let isChatsLinkUnread = false;

Callers 2

DiscussionListClass · 0.80
componentDidMountMethod · 0.80

Tested by

no test coverage detected