Loading child messages when opening the TMF
Part of #2202 (closed)
Purpose of this MR is to be able to load child messages when opening TMF.
What has been done:
- covered the
chatService
with more tests - converted
findChatMessagesForTroupe
toasync-await
- covered the
apiClient
with some tests - new function
chatService.findThreadChatMessages
- exposing the child messages on
/api/v1/rooms/{roomId}/chatMessages/{parentId}/thread
- fetching child messages upon opening TMF
-
style Loading and error messages -
log error if there is one during loading child messages(done byapiClient
) -
if we proceed with using the VuexApiRequest
:- write tests
- in a separate MR: convert the left menu code to use it
-
make sure that integration of VuexApiRequest
with the store is tested
UX reference
Error | Loading | Success |
---|---|---|
Testing
The threaded-conversations
toggle should be on. http://localhost:5000/api_web/features/threaded-conversations/1
- Open a thread message feed
- create 2 messages using the TMF chat input
- refresh the page and start a thread from the same parent message
- you should see the messages being fetched
Index:
- I've tested that the schema change results in the correct index being created:
parentId_1_sent_-1
ChatMessageSchema.index( { parentId: 1, sent: -1 }, { partialFilterExpression: { parentId: { $exists: true } }, background: true } );
troupeSet:PRIMARY> db.chatmessages.getIndexes() [ ... { "v" : 1, "key" : { "parentId" : 1, "sent" : -1 }, "name" : "parentId_1_sent_-1", "ns" : "gitter.chatmessages", "partialFilterExpression" : { "parentId" : { "$exists" : true } }, "background" : true } ]
Edited by Tomas Vik