Open Dialog

`open_dialog` is a streaming request that can emit multiple event types for the same command execution.

Flow: Open Dialog

Summary

open_dialog is a streaming request that can emit multiple event types for the same command execution.

Sequence

sequenceDiagram participant UI as Client participant WS as TDLibListChatsConsumer participant OWNER as AccountOwnerWorker participant H as dialogs handler participant D as DialogService participant M as Message/Channel builders UI->>WS: {"action": "open_dialog", ...} WS->>OWNER: publish_command(open_dialog) OWNER->>H: dispatch_command_payload(...) H->>D: open_dialog(...) D-->>H: iterator of result segments H->>M: parse_message / attach delivery / attach topic context H-->>UI: dialog_access H-->>UI: pinned_message* H-->>UI: forum_topics* or message* H-->>UI: pagination_setup* H-->>UI: dialog_end

Observable response variants

  • dialog_access
  • pinned_message
  • forum_topics
  • message
  • dialog_empty
  • pagination_setup
  • dialog_end
  • dialog_error

Files involved

  • backend/tg_client/dialogs/commands/handlers/dialogs.py
  • backend/tg_client/dialogs/tdlib/services/dialog_service.py
  • backend/tg_client/dialogs/tdlib/normalizers/dialog_normalizer.py
  • backend/tg_client/dialogs/domain/message.py
  • backend/tg_client/dialogs/domain/channel.py

Notes

  • when dialog results are not cached, the handler may mark unread messages as viewed after streaming
  • pinned messages are fetched through search_pinned_messages() only for top-level dialog open with from_message_id == 0 and without message_thread_id