(chatId: string, messageId: string, teamId: string)
| 194 | } |
| 195 | |
| 196 | public async loadThreadMessagesStoreMethod(chatId: string, messageId: string, teamId: string) { |
| 197 | if (this.isLoadingThreadMessages || this.store.isServer) { |
| 198 | return; |
| 199 | } |
| 200 | |
| 201 | this.isLoadingThreadMessages = true; |
| 202 | |
| 203 | try { |
| 204 | const { messagesInsideThread = [] } = await getThreadMessagesApiMethod({ |
| 205 | chatId, |
| 206 | messageId, |
| 207 | teamId, |
| 208 | }); |
| 209 | |
| 210 | runInAction(() => { |
| 211 | const messageObjs = messagesInsideThread.map( |
| 212 | (m) => new Message({ chat: this, store: this.store, team: this.team, ...m }), |
| 213 | ); |
| 214 | this.messagesInsideThread.replace(messageObjs); |
| 215 | }); |
| 216 | } catch (err) { |
| 217 | console.log(err); |
| 218 | } finally { |
| 219 | runInAction(() => { |
| 220 | this.isLoadingThreadMessages = false; |
| 221 | }); |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | export { Message }; |
no test coverage detected