Skip to content

Include child thread messages in main message feed on mobile

Tomas Vik requested to merge gitter-ios-app-55-support-threads into develop

Part of https://gitlab.com/gitlab-org/gitter/gitter-ios-app/issues/55

This MR introduces includeThreads option for chatService. This option allows clients of this service to specify they would like to include child messages in the search results.

Kapture_2020-02-03_at_14.54.46

3 ways to search for messages

graph LR
A[chat-internal] -- chat-snaphost-options --> N[chatService]
B[authorisor] -- populateSubTroupeCollection --> N
C[api/chatMessages] -- serializeChatsForTroupe --> N
  • chat-internal is used for rendering html page of the room
  • authorisor populate - is used to send a snapshot of the chat after subscribing to bayeux channel
  • API access to chat messages is used for infinite scrolling

DEV notes

  1. there is a body.mobile-embedded CSS. It's rendered to a template at the time when we generate assets for native mobile apps. then it is used by is-mobile-embedded.js which can be called anywhere on the frontend.
  2. we can translate the presence of mobile-embedded class into a includeThreads property. There are 3 places where the chatService.findChatMessagesForTroupe() the method gets called from.
    1. chat-internal serializing chats to a troupe
      • here we can easily leverage the req.isPhone property
    2. authorisor for bayeux, sending snapshot of messages after the user subscribes to a chatMessages channel
    3. API requests - used for infinite scrolling

Testing strategy

  1. have a room with 50+ messages in total, mixed thread and normal messages, with the room based feature toggle enabled
  2. Desktop and mobile web
    1. initial page load shouldn't contain any child messages
    2. Scroll up to trigger infinite scrolling, no child messages should be fetched, you can inspect the API request containing includeThreads=false
    3. (is still need to fix this one) send a threaded message from another user, verify that it doesn't show in the MMF. (unchanged behaviour - all threaded messages that are newly sent are in the markup, but we are hiding them using the threaded-conversation-chat-item CSS class)
  3. iOS app - you can compile assets by running NODE_ENV=dev npm run build-ios-assets and connect it to local webapp (https://gitlab.com/gitlab-org/gitter/gitter-ios-app/merge_requests/17)
    • validate that the arrow icon for -> 5 replies parent message indicator is present
    • all child messages are shown in the MMF, each one of them has an indicator that can be clicked and it opens a normal browser with the thread
Edited by Tomas Vik

Merge request reports