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_accesspinned_messageforum_topicsmessagedialog_emptypagination_setupdialog_enddialog_error
Files involved
backend/tg_client/dialogs/commands/handlers/dialogs.pybackend/tg_client/dialogs/tdlib/services/dialog_service.pybackend/tg_client/dialogs/tdlib/normalizers/dialog_normalizer.pybackend/tg_client/dialogs/domain/message.pybackend/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 withfrom_message_id == 0and withoutmessage_thread_id