({ teamId }: { teamId: string })
| 369 | // if user is Team Leader, show all Discussions inside Team |
| 370 | // review |
| 371 | public async loadActiveDiscussionsStoreMethod({ teamId }: { teamId: string }) { |
| 372 | if (this.store.isServer || this.isLoadingDiscussions) { |
| 373 | return; |
| 374 | } |
| 375 | |
| 376 | this.isLoadingDiscussions = true; |
| 377 | |
| 378 | try { |
| 379 | const { discussions = [] } = await getActiveDiscussionListApiMethod({ teamId }); |
| 380 | |
| 381 | runInAction(() => { |
| 382 | this.activeDiscussionsForUser.clear(); |
| 383 | |
| 384 | discussions.forEach((d) => { |
| 385 | const disObj = this.activeDiscussionsForUser.find((obj) => obj.discussionId === d._id); |
| 386 | if (disObj) { |
| 387 | disObj.changeLocalCacheStoreMethod(d); |
| 388 | } else { |
| 389 | const newD = new Discussion({ team: this.currentTeam, store: this.store, ...d }); |
| 390 | if (newD.discussionMemberIds.includes(this._id)) { |
| 391 | this.activeDiscussionsForUser.push(newD); |
| 392 | } |
| 393 | } |
| 394 | }); |
| 395 | }); |
| 396 | } finally { |
| 397 | runInAction(() => { |
| 398 | this.isLoadingDiscussions = false; |
| 399 | }); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | public async loadArchivedDiscussionsStoreMethod({ teamId }: { teamId: string }) { |
| 404 | if (this.store.isServer || this.isLoadingDiscussions) { |
no test coverage detected